From 880a13cdeb6a62c736e6468c41470a1f7d1b8ee7 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Fri, 5 Oct 2012 15:17:47 +0200 Subject: [PATCH 001/164] fixed bug in resampling for unsigned type images --- nipy/algorithms/registration/_registration.c | 4025 ++++++++++------- .../algorithms/registration/_registration.pyx | 7 +- nipy/algorithms/registration/cubic_spline.c | 8 +- 3 files changed, 2364 insertions(+), 1676 deletions(-) diff --git a/nipy/algorithms/registration/_registration.c b/nipy/algorithms/registration/_registration.c index e019120e65..606df12c86 100644 --- a/nipy/algorithms/registration/_registration.c +++ b/nipy/algorithms/registration/_registration.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.13 on Sat Sep 24 16:30:34 2011 */ +/* Generated by Cython 0.15.1 on Mon Oct 8 08:46:36 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -46,7 +46,7 @@ #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) @@ -126,15 +126,20 @@ #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif - #ifndef PySet_CheckExact -# define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -151,7 +156,16 @@ #endif #if PY_MAJOR_VERSION >= 3 - #define PyBoolObject PyLongObject + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif @@ -163,6 +177,25 @@ #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif @@ -185,16 +218,19 @@ #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" -#else -#define __PYX_EXTERN_C extern +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__algorithms__registration___registration #define __PYX_HAVE_API__nipy__algorithms__registration___registration #include "stdio.h" #include "stdlib.h" @@ -203,6 +239,14 @@ #include "joint_histogram.h" #include "cubic_spline.h" #include "polyaffine.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + /* inline attribute */ #ifndef CYTHON_INLINE @@ -213,7 +257,7 @@ #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif @@ -221,14 +265,14 @@ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) -# define CYTHON_UNUSED __attribute__ ((__unused__)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || defined(__INTEL_COMPILER) -# define CYTHON_UNUSED __attribute__ ((__unused__)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) # else -# define CYTHON_UNUSED +# define CYTHON_UNUSED # endif #endif @@ -240,6 +284,7 @@ typedef struct {PyObject **p; char *s; const long n; const char* encoding; const #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); @@ -252,17 +297,17 @@ static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -303,42 +348,193 @@ static const char *__pyx_f[] = { "numpy.pxd", }; +/* "numpy.pxd":719 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":720 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":721 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":722 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":726 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":727 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":728 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":729 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":733 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":734 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":743 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":744 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":745 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":747 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":748 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":749 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":751 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":754 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":755 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":756 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; #if CYTHON_CCOMPLEX @@ -361,14 +557,42 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ +/* "numpy.pxd":758 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":759 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":760 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":762 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; #ifndef CYTHON_REFNANNY @@ -385,69 +609,75 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else + #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +#include -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals +#else +#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals +#endif #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -482,11 +712,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -497,7 +733,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -512,11 +751,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -527,7 +772,10 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); @@ -562,27 +810,30 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from cpython.buffer */ -/* Module declarations from cpython.ref */ +/* Module declarations from 'cpython.buffer' */ -/* Module declarations from libc.stdio */ +/* Module declarations from 'cpython.ref' */ -/* Module declarations from cpython.object */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from libc.stdlib */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from 'libc.stdlib' */ -/* Module declarations from numpy */ +/* Module declarations from 'numpy' */ +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; @@ -596,33 +847,30 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from nipy.algorithms.registration._registration */ +/* Module declarations from 'nipy.algorithms.registration._registration' */ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(PyObject *, PyArrayObject *); /*proto*/ #define __Pyx_MODULE_NAME "nipy.algorithms.registration._registration" int __pyx_module_is_main_nipy__algorithms__registration___registration = 0; -/* Implementation of nipy.algorithms.registration._registration */ +/* Implementation of 'nipy.algorithms.registration._registration' */ static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static char __pyx_k_1[] = "Joint histogram failed because of incorrect input arrays."; -static char __pyx_k_2[] = "L1_moments failed because input array is not double."; -static char __pyx_k_3[] = "%s array should be double C-contiguous"; -static char __pyx_k_4[] = "%s has size %d in last dimension, %d expected"; -static char __pyx_k_5[] = "centers and affines arrays should have same shape[0]"; -static char __pyx_k_6[] = "ndarray is not C contiguous"; -static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_8[] = "Non-native byte order not supported"; -static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_11[] = "Format string allocated too short."; -static char __pyx_k_12[] = "\nBindings for various image registration routines written in C: joint\nhistogram computation, cubic spline interpolation, non-rigid\ntransformations. \n"; -static char __pyx_k_13[] = "0.3"; -static char __pyx_k_14[] = "_joint_histogram (line 57)"; -static char __pyx_k_15[] = "_L1_moments (line 78)"; -static char __pyx_k_16[] = "_cspline_sample4d (line 148)"; -static char __pyx_k_17[] = "_cspline_resample3d (line 171)"; +static char __pyx_k_3[] = "L1_moments failed because input array is not double."; +static char __pyx_k_5[] = "%s array should be double C-contiguous"; +static char __pyx_k_6[] = "%s has size %d in last dimension, %d expected"; +static char __pyx_k_7[] = "centers and affines arrays should have same shape[0]"; +static char __pyx_k_9[] = "ndarray is not C contiguous"; +static char __pyx_k_11[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_13[] = "Non-native byte order not supported"; +static char __pyx_k_15[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_16[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_19[] = "Format string allocated too short."; +static char __pyx_k_21[] = "\nBindings for various image registration routines written in C: joint\nhistogram computation, cubic spline interpolation, non-rigid\ntransformations. \n"; +static char __pyx_k_22[] = "0.3"; +static char __pyx_k_23[] = "nipy.algorithms.registration._registration"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -643,6 +891,7 @@ static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; +static char __pyx_k__u[] = "u"; static char __pyx_k__x[] = "x"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; @@ -653,79 +902,64 @@ static char __pyx_k__mx[] = "mx"; static char __pyx_k__my[] = "my"; static char __pyx_k__mz[] = "mz"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; static char __pyx_k__dim[] = "dim"; static char __pyx_k__imJ[] = "imJ"; -static char __pyx_k__obj[] = "obj"; static char __pyx_k__xyz[] = "xyz"; static char __pyx_k__Tvox[] = "Tvox"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; static char __pyx_k__dims[] = "dims"; +static char __pyx_k__kind[] = "kind"; static char __pyx_k__mode[] = "mode"; -static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__size[] = "size"; static char __pyx_k__zero[] = "zero"; -static char __pyx_k__descr[] = "descr"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__flags[] = "flags"; static char __pyx_k__index[] = "index"; static char __pyx_k__iterI[] = "iterI"; static char __pyx_k__modes[] = "modes"; -static char __pyx_k__names[] = "names"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__order[] = "order"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; static char __pyx_k__sigma[] = "sigma"; static char __pyx_k__xname[] = "xname"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__astype[] = "astype"; static char __pyx_k__double[] = "double"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; static char __pyx_k__interp[] = "interp"; static char __pyx_k__affines[] = "affines"; static char __pyx_k__asarray[] = "asarray"; static char __pyx_k__centers[] = "centers"; static char __pyx_k__exp_dim[] = "exp_dim"; -static char __pyx_k__integer[] = "integer"; static char __pyx_k__nearest[] = "nearest"; static char __pyx_k__reflect[] = "reflect"; static char __pyx_k__reshape[] = "reshape"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__issubdtype[] = "issubdtype"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k___L1_moments[] = "_L1_moments"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__check_array[] = "check_array"; static char __pyx_k__C_CONTIGUOUS[] = "C_CONTIGUOUS"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k___joint_histogram[] = "_joint_histogram"; +static char __pyx_k___apply_polyaffine[] = "_apply_polyaffine"; +static char __pyx_k___cspline_sample1d[] = "_cspline_sample1d"; +static char __pyx_k___cspline_sample2d[] = "_cspline_sample2d"; +static char __pyx_k___cspline_sample3d[] = "_cspline_sample3d"; static char __pyx_k___cspline_sample4d[] = "_cspline_sample4d"; +static char __pyx_k___cspline_transform[] = "_cspline_transform"; static char __pyx_k___cspline_resample3d[] = "_cspline_resample3d"; static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_11; -static PyObject *__pyx_kp_s_13; -static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_kp_u_16; -static PyObject *__pyx_kp_u_17; -static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_u_19; +static PyObject *__pyx_kp_s_22; +static PyObject *__pyx_n_s_23; static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_s_4; static PyObject *__pyx_kp_s_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__C_CONTIGUOUS; @@ -742,58 +976,48 @@ static PyObject *__pyx_n_s___L1_moments; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; +static PyObject *__pyx_n_s___apply_polyaffine; static PyObject *__pyx_n_s___cspline_resample3d; +static PyObject *__pyx_n_s___cspline_sample1d; +static PyObject *__pyx_n_s___cspline_sample2d; +static PyObject *__pyx_n_s___cspline_sample3d; static PyObject *__pyx_n_s___cspline_sample4d; +static PyObject *__pyx_n_s___cspline_transform; static PyObject *__pyx_n_s___joint_histogram; static PyObject *__pyx_n_s__affines; static PyObject *__pyx_n_s__asarray; static PyObject *__pyx_n_s__astype; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__centers; static PyObject *__pyx_n_s__check_array; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; static PyObject *__pyx_n_s__dim; static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__exp_dim; -static PyObject *__pyx_n_s__fields; static PyObject *__pyx_n_s__flags; -static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__im; static PyObject *__pyx_n_s__imJ; static PyObject *__pyx_n_s__index; -static PyObject *__pyx_n_s__integer; static PyObject *__pyx_n_s__interp; -static PyObject *__pyx_n_s__issubdtype; -static PyObject *__pyx_n_s__itemsize; static PyObject *__pyx_n_s__iterI; +static PyObject *__pyx_n_s__kind; static PyObject *__pyx_n_s__mode; static PyObject *__pyx_n_s__modes; static PyObject *__pyx_n_s__mt; static PyObject *__pyx_n_s__mx; static PyObject *__pyx_n_s__my; static PyObject *__pyx_n_s__mz; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__nearest; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__order; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; static PyObject *__pyx_n_s__reflect; static PyObject *__pyx_n_s__reshape; -static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__sigma; static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__u; static PyObject *__pyx_n_s__x; static PyObject *__pyx_n_s__xname; static PyObject *__pyx_n_s__xyz; @@ -805,8 +1029,17 @@ static PyObject *__pyx_int_2; static PyObject *__pyx_int_3; static PyObject *__pyx_int_12; static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_20; -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":57 +/* "nipy/algorithms/registration/_registration.pyx":57 * * * def _joint_histogram(ndarray H, flatiter iterI, ndarray imJ, ndarray Tvox, long interp): # <<<<<<<<<<<<<< @@ -816,6 +1049,7 @@ static PyObject *__pyx_int_15; static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram[] = "\n Compute the joint histogram given a transformation trial. \n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration__joint_histogram = {__Pyx_NAMESTR("_joint_histogram"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram)}; static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_H = 0; PyArrayIterObject *__pyx_v_iterI = 0; @@ -826,76 +1060,82 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi unsigned int __pyx_v_clampJ; int __pyx_v_ret; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__H,&__pyx_n_s__iterI,&__pyx_n_s__imJ,&__pyx_n_s__Tvox,&__pyx_n_s__interp,0}; __Pyx_RefNannySetupContext("_joint_histogram"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__H); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterI); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imJ); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__H); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterI); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imJ); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp); + if (likely(values[4])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_joint_histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_joint_histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_H = ((PyArrayObject *)values[0]); __pyx_v_iterI = ((PyArrayIterObject *)values[1]); __pyx_v_imJ = ((PyArrayObject *)values[2]); __pyx_v_Tvox = ((PyArrayObject *)values[3]); __pyx_v_interp = __Pyx_PyInt_AsLong(values[4]); if (unlikely((__pyx_v_interp == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_H = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_iterI = ((PyArrayIterObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_imJ = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_Tvox = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_interp = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_interp == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._joint_histogram"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._joint_histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; @@ -904,7 +1144,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_imJ), __pyx_ptype_5numpy_ndarray, 1, "imJ", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Tvox), __pyx_ptype_5numpy_ndarray, 1, "Tvox", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":67 + /* "nipy/algorithms/registration/_registration.pyx":67 * * # Views * clampI = H.shape[0] # <<<<<<<<<<<<<< @@ -913,7 +1153,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi */ __pyx_v_clampI = ((unsigned int)(__pyx_v_H->dimensions[0])); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":68 + /* "nipy/algorithms/registration/_registration.pyx":68 * # Views * clampI = H.shape[0] * clampJ = H.shape[1] # <<<<<<<<<<<<<< @@ -922,7 +1162,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi */ __pyx_v_clampJ = ((unsigned int)(__pyx_v_H->dimensions[1])); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":71 + /* "nipy/algorithms/registration/_registration.pyx":71 * * # Compute joint histogram * ret = joint_histogram(H, clampI, clampJ, iterI, imJ, Tvox, interp) # <<<<<<<<<<<<<< @@ -931,7 +1171,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi */ __pyx_v_ret = joint_histogram(__pyx_v_H, __pyx_v_clampI, __pyx_v_clampJ, __pyx_v_iterI, __pyx_v_imJ, __pyx_v_Tvox, __pyx_v_interp); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":72 + /* "nipy/algorithms/registration/_registration.pyx":72 * # Compute joint histogram * ret = joint_histogram(H, clampI, clampJ, iterI, imJ, Tvox, interp) * if not ret == 0: # <<<<<<<<<<<<<< @@ -941,29 +1181,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi __pyx_t_1 = (!(__pyx_v_ret == 0)); if (__pyx_t_1) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":73 + /* "nipy/algorithms/registration/_registration.pyx":73 * ret = joint_histogram(H, clampI, clampJ, iterI, imJ, Tvox, interp) * if not ret == 0: * raise RuntimeError('Joint histogram failed because of incorrect input arrays.') # <<<<<<<<<<<<<< * * return */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":75 + /* "nipy/algorithms/registration/_registration.pyx":75 * raise RuntimeError('Joint histogram failed because of incorrect input arrays.') * * return # <<<<<<<<<<<<<< @@ -978,8 +1212,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._joint_histogram"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._joint_histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -987,7 +1220,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":78 +/* "nipy/algorithms/registration/_registration.pyx":78 * * * def _L1_moments(ndarray H): # <<<<<<<<<<<<<< @@ -995,24 +1228,29 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi * Compute L1 moments of order 0, 1 and 2 of a one-dimensional */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration__L1_moments[] = "\n Compute L1 moments of order 0, 1 and 2 of a one-dimensional\n histogram.\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_1_L1_moments[] = "\n Compute L1 moments of order 0, 1 and 2 of a one-dimensional\n histogram.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_L1_moments = {__Pyx_NAMESTR("_L1_moments"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_1_L1_moments)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H) { double __pyx_v_n[1]; double __pyx_v_median[1]; double __pyx_v_dev[1]; int __pyx_v_ret; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_L1_moments"); __pyx_self = __pyx_self; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_5numpy_ndarray, 1, "H", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":87 + /* "nipy/algorithms/registration/_registration.pyx":87 * int ret * * ret = L1_moments(n, median, dev, H) # <<<<<<<<<<<<<< @@ -1021,7 +1259,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ */ __pyx_v_ret = L1_moments(__pyx_v_n, __pyx_v_median, __pyx_v_dev, ((PyArrayObject *)__pyx_v_H)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":88 + /* "nipy/algorithms/registration/_registration.pyx":88 * * ret = L1_moments(n, median, dev, H) * if not ret == 0: # <<<<<<<<<<<<<< @@ -1031,29 +1269,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ __pyx_t_1 = (!(__pyx_v_ret == 0)); if (__pyx_t_1) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":89 + /* "nipy/algorithms/registration/_registration.pyx":89 * ret = L1_moments(n, median, dev, H) * if not ret == 0: * raise RuntimeError('L1_moments failed because input array is not double.') # <<<<<<<<<<<<<< * * return n[0], median[0], dev[0] */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":91 + /* "nipy/algorithms/registration/_registration.pyx":91 * raise RuntimeError('L1_moments failed because input array is not double.') * * return n[0], median[0], dev[0] # <<<<<<<<<<<<<< @@ -1061,24 +1293,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble((__pyx_v_n[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyFloat_FromDouble((__pyx_v_median[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_n[0])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble((__pyx_v_median[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyFloat_FromDouble((__pyx_v_dev[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_3 = 0; __pyx_t_2 = 0; + __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_r = __pyx_t_5; + __pyx_r = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L0; @@ -1089,7 +1321,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._L1_moments"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._L1_moments", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1097,7 +1329,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":94 +/* "nipy/algorithms/registration/_registration.pyx":94 * * * def _cspline_transform(ndarray x): # <<<<<<<<<<<<<< @@ -1105,11 +1337,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_ * cubic_spline_transform(c, x) */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x) { - PyObject *__pyx_v_c; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_2_cspline_transform = {__Pyx_NAMESTR("_cspline_transform"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_v_c = NULL; int __pyx_v_i; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; @@ -1117,12 +1351,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_cspline_transform"); __pyx_self = __pyx_self; - __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":95 + /* "nipy/algorithms/registration/_registration.pyx":95 * * def _cspline_transform(ndarray x): * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) # <<<<<<<<<<<<<< @@ -1145,7 +1381,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -1159,16 +1395,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_5, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_c); __pyx_v_c = __pyx_t_7; __pyx_t_7 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":96 + /* "nipy/algorithms/registration/_registration.pyx":96 * def _cspline_transform(ndarray x): * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) * cubic_spline_transform(c, x) # <<<<<<<<<<<<<< @@ -1176,9 +1411,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * */ if (!(likely(((__pyx_v_c) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_c, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - cubic_spline_transform(((PyArrayObject *)__pyx_v_c), ((PyArrayObject *)__pyx_v_x)); + __pyx_t_7 = __pyx_v_c; + __Pyx_INCREF(__pyx_t_7); + cubic_spline_transform(((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_v_x)); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":97 + /* "nipy/algorithms/registration/_registration.pyx":97 * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) * cubic_spline_transform(c, x) * return c # <<<<<<<<<<<<<< @@ -1198,16 +1436,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_transform"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_c); + __Pyx_XDECREF(__pyx_v_c); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":99 +/* "nipy/algorithms/registration/_registration.pyx":99 * return c * * cdef ndarray _reshaped_double(object in_arr, ndarray sh_arr): # <<<<<<<<<<<<<< @@ -1215,19 +1453,22 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * return np.reshape(in_arr, shape).astype(np.double) */ -static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(PyObject *__pyx_v_in_arr, PyArrayObject *__pyx_v_sh_arr) { - PyObject *__pyx_v_shape; +static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(PyObject *__pyx_v_in_arr, PyArrayObject *__pyx_v_sh_arr) { + PyObject *__pyx_v_shape = NULL; int __pyx_v_i; PyArrayObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_reshaped_double"); - __pyx_v_shape = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":100 + /* "nipy/algorithms/registration/_registration.pyx":100 * * cdef ndarray _reshaped_double(object in_arr, ndarray sh_arr): * shape = [sh_arr.shape[i] for i in range(sh_arr.ndim)] # <<<<<<<<<<<<<< @@ -1245,11 +1486,10 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_v_shape)); __pyx_v_shape = __pyx_t_1; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":101 + /* "nipy/algorithms/registration/_registration.pyx":101 * cdef ndarray _reshaped_double(object in_arr, ndarray sh_arr): * shape = [sh_arr.shape[i] for i in range(sh_arr.ndim)] * return np.reshape(in_arr, shape).astype(np.double) # <<<<<<<<<<<<<< @@ -1263,17 +1503,17 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_in_arr); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_in_arr); __Pyx_GIVEREF(__pyx_v_in_arr); __Pyx_INCREF(((PyObject *)__pyx_v_shape)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_shape)); __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); - __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -1283,14 +1523,14 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; @@ -1302,16 +1542,16 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._reshaped_double"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._reshaped_double", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; - __Pyx_DECREF(__pyx_v_shape); + __Pyx_XDECREF(__pyx_v_shape); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":103 +/* "nipy/algorithms/registration/_registration.pyx":103 * return np.reshape(in_arr, shape).astype(np.double) * * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): # <<<<<<<<<<<<<< @@ -1319,96 +1559,97 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration * cdef broadcast multi */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d = {__Pyx_NAMESTR("_cspline_sample1d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_mode = 0; double *__pyx_v_r; double *__pyx_v_x; - PyArrayMultiIterObject *__pyx_v_multi; - PyArrayObject *__pyx_v_Xa; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__mode,0}; __Pyx_RefNannySetupContext("_cspline_sample1d"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_sample1d", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (value) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_sample1d", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); + if (value) { values[3] = value; kw_args--; } + } } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mode); - if (value) { values[3] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_R = ((PyArrayObject *)values[0]); __pyx_v_C = ((PyArrayObject *)values[1]); __pyx_v_X = values[2]; __pyx_v_mode = values[3]; - } else { - __pyx_v_X = ((PyObject *)__pyx_int_0); - __pyx_v_mode = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: - __pyx_v_mode = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_C = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_R = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_cspline_sample1d", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample1d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Xa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":106 + /* "nipy/algorithms/registration/_registration.pyx":106 * cdef double *r, *x * cdef broadcast multi * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< @@ -1417,11 +1658,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_X, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Xa)); __pyx_v_Xa = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":107 + /* "nipy/algorithms/registration/_registration.pyx":107 * cdef broadcast multi * Xa = _reshaped_double(X, R) * multi = PyArray_MultiIterNew(2, R, Xa) # <<<<<<<<<<<<<< @@ -1431,11 +1671,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_R), ((void *)__pyx_v_Xa)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_broadcast))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_multi)); __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":108 + /* "nipy/algorithms/registration/_registration.pyx":108 * Xa = _reshaped_double(X, R) * multi = PyArray_MultiIterNew(2, R, Xa) * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1455,7 +1694,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) break; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":109 + /* "nipy/algorithms/registration/_registration.pyx":109 * multi = PyArray_MultiIterNew(2, R, Xa) * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -1464,7 +1703,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_r = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":110 + /* "nipy/algorithms/registration/_registration.pyx":110 * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -1473,7 +1712,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_x = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":111 + /* "nipy/algorithms/registration/_registration.pyx":111 * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) * r[0] = cubic_spline_sample1d(x[0], C, modes[mode]) # <<<<<<<<<<<<<< @@ -1489,7 +1728,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_r[0]) = cubic_spline_sample1d((__pyx_v_x[0]), __pyx_v_C, __pyx_t_5); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":112 + /* "nipy/algorithms/registration/_registration.pyx":112 * x = PyArray_MultiIter_DATA(multi, 1) * r[0] = cubic_spline_sample1d(x[0], C, modes[mode]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -1499,7 +1738,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyArray_MultiIter_NEXT(__pyx_v_multi); } - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":113 + /* "nipy/algorithms/registration/_registration.pyx":113 * r[0] = cubic_spline_sample1d(x[0], C, modes[mode]) * PyArray_MultiIter_NEXT(multi) * return R # <<<<<<<<<<<<<< @@ -1517,17 +1756,17 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample1d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_multi); - __Pyx_DECREF((PyObject *)__pyx_v_Xa); + __Pyx_XDECREF((PyObject *)__pyx_v_multi); + __Pyx_XDECREF((PyObject *)__pyx_v_Xa); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":115 +/* "nipy/algorithms/registration/_registration.pyx":115 * return R * * def _cspline_sample2d(ndarray R, ndarray C, X=0, Y=0, # <<<<<<<<<<<<<< @@ -1535,8 +1774,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * cdef double *r, *x, *y */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d = {__Pyx_NAMESTR("_cspline_sample2d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; @@ -1546,113 +1786,108 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp double *__pyx_v_r; double *__pyx_v_x; double *__pyx_v_y; - PyArrayMultiIterObject *__pyx_v_multi; - PyArrayObject *__pyx_v_Xa; - PyArrayObject *__pyx_v_Ya; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__mx,&__pyx_n_s__my,0}; __Pyx_RefNannySetupContext("_cspline_sample2d"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[6] = {0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); values[4] = ((PyObject *)__pyx_n_s__zero); values[5] = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_sample2d", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (value) { values[2] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (value) { values[3] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_sample2d", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); - if (value) { values[4] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); - if (value) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_R = ((PyArrayObject *)values[0]); __pyx_v_C = ((PyArrayObject *)values[1]); __pyx_v_X = values[2]; __pyx_v_Y = values[3]; __pyx_v_mx = values[4]; __pyx_v_my = values[5]; - } else { - __pyx_v_X = ((PyObject *)__pyx_int_0); - __pyx_v_Y = ((PyObject *)__pyx_int_0); - __pyx_v_mx = ((PyObject *)__pyx_n_s__zero); - __pyx_v_my = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_my = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: - __pyx_v_mx = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_C = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_R = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_cspline_sample2d", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample2d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Xa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Ya = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":119 + /* "nipy/algorithms/registration/_registration.pyx":119 * cdef double *r, *x, *y * cdef broadcast multi * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< @@ -1661,11 +1896,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_X, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Xa)); __pyx_v_Xa = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":120 + /* "nipy/algorithms/registration/_registration.pyx":120 * cdef broadcast multi * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) # <<<<<<<<<<<<<< @@ -1674,11 +1908,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_Y, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Ya)); __pyx_v_Ya = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":121 + /* "nipy/algorithms/registration/_registration.pyx":121 * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) * multi = PyArray_MultiIterNew(3, R, Xa, Ya) # <<<<<<<<<<<<<< @@ -1688,11 +1921,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_R), ((void *)__pyx_v_Xa), ((void *)__pyx_v_Ya)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_broadcast))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_multi)); __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":122 + /* "nipy/algorithms/registration/_registration.pyx":122 * Ya = _reshaped_double(Y, R) * multi = PyArray_MultiIterNew(3, R, Xa, Ya) * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1712,7 +1944,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) break; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":123 + /* "nipy/algorithms/registration/_registration.pyx":123 * multi = PyArray_MultiIterNew(3, R, Xa, Ya) * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -1721,7 +1953,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_r = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":124 + /* "nipy/algorithms/registration/_registration.pyx":124 * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -1730,7 +1962,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_x = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":125 + /* "nipy/algorithms/registration/_registration.pyx":125 * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -1739,7 +1971,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_y = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":126 + /* "nipy/algorithms/registration/_registration.pyx":126 * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) * r[0] = cubic_spline_sample2d(x[0], y[0], C, modes[mx], modes[my]) # <<<<<<<<<<<<<< @@ -1762,7 +1994,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_r[0]) = cubic_spline_sample2d((__pyx_v_x[0]), (__pyx_v_y[0]), __pyx_v_C, __pyx_t_5, __pyx_t_6); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":127 + /* "nipy/algorithms/registration/_registration.pyx":127 * y = PyArray_MultiIter_DATA(multi, 2) * r[0] = cubic_spline_sample2d(x[0], y[0], C, modes[mx], modes[my]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -1772,7 +2004,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyArray_MultiIter_NEXT(__pyx_v_multi); } - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":128 + /* "nipy/algorithms/registration/_registration.pyx":128 * r[0] = cubic_spline_sample2d(x[0], y[0], C, modes[mx], modes[my]) * PyArray_MultiIter_NEXT(multi) * return R # <<<<<<<<<<<<<< @@ -1790,18 +2022,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample2d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_multi); - __Pyx_DECREF((PyObject *)__pyx_v_Xa); - __Pyx_DECREF((PyObject *)__pyx_v_Ya); + __Pyx_XDECREF((PyObject *)__pyx_v_multi); + __Pyx_XDECREF((PyObject *)__pyx_v_Xa); + __Pyx_XDECREF((PyObject *)__pyx_v_Ya); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":130 +/* "nipy/algorithms/registration/_registration.pyx":130 * return R * * def _cspline_sample3d(ndarray R, ndarray C, X=0, Y=0, Z=0, # <<<<<<<<<<<<<< @@ -1809,8 +2041,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * cdef double *r, *x, *y, *z */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d = {__Pyx_NAMESTR("_cspline_sample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; @@ -1823,11 +2056,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp double *__pyx_v_x; double *__pyx_v_y; double *__pyx_v_z; - PyArrayMultiIterObject *__pyx_v_multi; - PyArrayObject *__pyx_v_Xa; - PyArrayObject *__pyx_v_Ya; - PyArrayObject *__pyx_v_Za; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; + PyArrayObject *__pyx_v_Za = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -1835,11 +2069,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; __Pyx_RefNannySetupContext("_cspline_sample3d"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[8] = {0,0,0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); @@ -1847,63 +2083,80 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp values[5] = ((PyObject *)__pyx_n_s__zero); values[6] = ((PyObject *)__pyx_n_s__zero); values[7] = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_sample3d", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Z); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); - if (value) { values[5] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_sample3d", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Z); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); + if (value) { values[7] = value; kw_args--; } + } } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); - if (value) { values[6] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); - if (value) { values[7] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_R = ((PyArrayObject *)values[0]); __pyx_v_C = ((PyArrayObject *)values[1]); __pyx_v_X = values[2]; @@ -1912,49 +2165,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_v_mx = values[5]; __pyx_v_my = values[6]; __pyx_v_mz = values[7]; - } else { - __pyx_v_X = ((PyObject *)__pyx_int_0); - __pyx_v_Y = ((PyObject *)__pyx_int_0); - __pyx_v_Z = ((PyObject *)__pyx_int_0); - __pyx_v_mx = ((PyObject *)__pyx_n_s__zero); - __pyx_v_my = ((PyObject *)__pyx_n_s__zero); - __pyx_v_mz = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: - __pyx_v_mz = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: - __pyx_v_my = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: - __pyx_v_mx = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: - __pyx_v_Z = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_C = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_R = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_cspline_sample3d", 0, 2, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample3d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Xa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Ya = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Za = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":134 + /* "nipy/algorithms/registration/_registration.pyx":134 * cdef double *r, *x, *y, *z * cdef broadcast multi * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< @@ -1963,11 +2186,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_X, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Xa)); __pyx_v_Xa = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":135 + /* "nipy/algorithms/registration/_registration.pyx":135 * cdef broadcast multi * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) # <<<<<<<<<<<<<< @@ -1976,11 +2198,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_Y, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Ya)); __pyx_v_Ya = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":136 + /* "nipy/algorithms/registration/_registration.pyx":136 * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) * Za = _reshaped_double(Z, R) # <<<<<<<<<<<<<< @@ -1989,11 +2210,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_Z, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Za)); __pyx_v_Za = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":137 + /* "nipy/algorithms/registration/_registration.pyx":137 * Ya = _reshaped_double(Y, R) * Za = _reshaped_double(Z, R) * multi = PyArray_MultiIterNew(4, R, Xa, Ya, Za) # <<<<<<<<<<<<<< @@ -2003,11 +2223,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_R), ((void *)__pyx_v_Xa), ((void *)__pyx_v_Ya), ((void *)__pyx_v_Za)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_broadcast))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_multi)); __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":138 + /* "nipy/algorithms/registration/_registration.pyx":138 * Za = _reshaped_double(Z, R) * multi = PyArray_MultiIterNew(4, R, Xa, Ya, Za) * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -2027,7 +2246,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) break; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":139 + /* "nipy/algorithms/registration/_registration.pyx":139 * multi = PyArray_MultiIterNew(4, R, Xa, Ya, Za) * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -2036,7 +2255,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_r = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":140 + /* "nipy/algorithms/registration/_registration.pyx":140 * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -2045,7 +2264,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_x = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":141 + /* "nipy/algorithms/registration/_registration.pyx":141 * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -2054,7 +2273,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_y = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":142 + /* "nipy/algorithms/registration/_registration.pyx":142 * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) * z = PyArray_MultiIter_DATA(multi, 3) # <<<<<<<<<<<<<< @@ -2063,7 +2282,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_z = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 3)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":143 + /* "nipy/algorithms/registration/_registration.pyx":143 * y = PyArray_MultiIter_DATA(multi, 2) * z = PyArray_MultiIter_DATA(multi, 3) * r[0] = cubic_spline_sample3d(x[0], y[0], z[0], C, modes[mx], modes[my], modes[mz]) # <<<<<<<<<<<<<< @@ -2093,7 +2312,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; (__pyx_v_r[0]) = cubic_spline_sample3d((__pyx_v_x[0]), (__pyx_v_y[0]), (__pyx_v_z[0]), __pyx_v_C, __pyx_t_5, __pyx_t_6, __pyx_t_7); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":144 + /* "nipy/algorithms/registration/_registration.pyx":144 * z = PyArray_MultiIter_DATA(multi, 3) * r[0] = cubic_spline_sample3d(x[0], y[0], z[0], C, modes[mx], modes[my], modes[mz]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -2103,7 +2322,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyArray_MultiIter_NEXT(__pyx_v_multi); } - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":145 + /* "nipy/algorithms/registration/_registration.pyx":145 * r[0] = cubic_spline_sample3d(x[0], y[0], z[0], C, modes[mx], modes[my], modes[mz]) * PyArray_MultiIter_NEXT(multi) * return R # <<<<<<<<<<<<<< @@ -2121,19 +2340,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample3d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_multi); - __Pyx_DECREF((PyObject *)__pyx_v_Xa); - __Pyx_DECREF((PyObject *)__pyx_v_Ya); - __Pyx_DECREF((PyObject *)__pyx_v_Za); + __Pyx_XDECREF((PyObject *)__pyx_v_multi); + __Pyx_XDECREF((PyObject *)__pyx_v_Xa); + __Pyx_XDECREF((PyObject *)__pyx_v_Ya); + __Pyx_XDECREF((PyObject *)__pyx_v_Za); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":148 +/* "nipy/algorithms/registration/_registration.pyx":148 * * * def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, # <<<<<<<<<<<<<< @@ -2141,9 +2360,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * """ */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration__cspline_sample4d[] = "\n In-place cubic spline sampling. R.dtype must be 'double'. \n "; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d[] = "\n In-place cubic spline sampling. R.dtype must be 'double'. \n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d = {__Pyx_NAMESTR("_cspline_sample4d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; @@ -2159,12 +2379,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp double *__pyx_v_y; double *__pyx_v_z; double *__pyx_v_t; - PyArrayMultiIterObject *__pyx_v_multi; - PyArrayObject *__pyx_v_Xa; - PyArrayObject *__pyx_v_Ya; - PyArrayObject *__pyx_v_Za; - PyArrayObject *__pyx_v_Ta; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; + PyArrayObject *__pyx_v_Za = NULL; + PyArrayObject *__pyx_v_Ta = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; @@ -2173,11 +2394,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__T,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,&__pyx_n_s__mt,0}; __Pyx_RefNannySetupContext("_cspline_sample4d"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); @@ -2187,75 +2410,94 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp values[7] = ((PyObject *)__pyx_n_s__zero); values[8] = ((PyObject *)__pyx_n_s__zero); values[9] = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_sample4d", 0, 2, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (value) { values[2] = value; kw_args--; } - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (value) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Z); - if (value) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T); - if (value) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); - if (value) { values[6] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); - if (value) { values[7] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_sample4d", 0, 2, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Z); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__T); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); + if (value) { values[8] = value; kw_args--; } + } + case 9: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mt); + if (value) { values[9] = value; kw_args--; } + } } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); - if (value) { values[8] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample4d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mt); - if (value) { values[9] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample4d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_R = ((PyArrayObject *)values[0]); __pyx_v_C = ((PyArrayObject *)values[1]); __pyx_v_X = values[2]; @@ -2266,56 +2508,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_v_my = values[7]; __pyx_v_mz = values[8]; __pyx_v_mt = values[9]; - } else { - __pyx_v_X = ((PyObject *)__pyx_int_0); - __pyx_v_Y = ((PyObject *)__pyx_int_0); - __pyx_v_Z = ((PyObject *)__pyx_int_0); - __pyx_v_T = ((PyObject *)__pyx_int_0); - __pyx_v_mx = ((PyObject *)__pyx_n_s__zero); - __pyx_v_my = ((PyObject *)__pyx_n_s__zero); - __pyx_v_mz = ((PyObject *)__pyx_n_s__zero); - __pyx_v_mt = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 10: - __pyx_v_mt = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: - __pyx_v_mz = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: - __pyx_v_my = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: - __pyx_v_mx = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: - __pyx_v_T = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: - __pyx_v_Z = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_C = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_R = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_cspline_sample4d", 0, 2, 10, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample4d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample4d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Xa = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Ya = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Za = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_Ta = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":155 + /* "nipy/algorithms/registration/_registration.pyx":155 * cdef double *r, *x, *y, *z, *t * cdef broadcast multi * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< @@ -2324,11 +2529,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_X, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Xa)); __pyx_v_Xa = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":156 + /* "nipy/algorithms/registration/_registration.pyx":156 * cdef broadcast multi * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) # <<<<<<<<<<<<<< @@ -2337,11 +2541,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_Y, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Ya)); __pyx_v_Ya = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":157 + /* "nipy/algorithms/registration/_registration.pyx":157 * Xa = _reshaped_double(X, R) * Ya = _reshaped_double(Y, R) * Za = _reshaped_double(Z, R) # <<<<<<<<<<<<<< @@ -2350,11 +2553,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_Z, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Za)); __pyx_v_Za = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":158 + /* "nipy/algorithms/registration/_registration.pyx":158 * Ya = _reshaped_double(Y, R) * Za = _reshaped_double(Z, R) * Ta = _reshaped_double(T, R) # <<<<<<<<<<<<<< @@ -2363,11 +2565,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_T, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_v_Ta)); __pyx_v_Ta = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":159 + /* "nipy/algorithms/registration/_registration.pyx":159 * Za = _reshaped_double(Z, R) * Ta = _reshaped_double(T, R) * multi = PyArray_MultiIterNew(5, R, Xa, Ya, Za, Ta) # <<<<<<<<<<<<<< @@ -2377,11 +2578,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_R), ((void *)__pyx_v_Xa), ((void *)__pyx_v_Ya), ((void *)__pyx_v_Za), ((void *)__pyx_v_Ta)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_broadcast))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_multi)); __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":160 + /* "nipy/algorithms/registration/_registration.pyx":160 * Ta = _reshaped_double(T, R) * multi = PyArray_MultiIterNew(5, R, Xa, Ya, Za, Ta) * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -2401,7 +2601,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_4) break; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":161 + /* "nipy/algorithms/registration/_registration.pyx":161 * multi = PyArray_MultiIterNew(5, R, Xa, Ya, Za, Ta) * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) # <<<<<<<<<<<<<< @@ -2410,7 +2610,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_r = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 0)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":162 + /* "nipy/algorithms/registration/_registration.pyx":162 * while(multi.index < multi.size): * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) # <<<<<<<<<<<<<< @@ -2419,7 +2619,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_x = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 1)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":163 + /* "nipy/algorithms/registration/_registration.pyx":163 * r = PyArray_MultiIter_DATA(multi, 0) * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) # <<<<<<<<<<<<<< @@ -2428,7 +2628,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_y = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 2)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":164 + /* "nipy/algorithms/registration/_registration.pyx":164 * x = PyArray_MultiIter_DATA(multi, 1) * y = PyArray_MultiIter_DATA(multi, 2) * z = PyArray_MultiIter_DATA(multi, 3) # <<<<<<<<<<<<<< @@ -2437,7 +2637,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_z = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 3)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":165 + /* "nipy/algorithms/registration/_registration.pyx":165 * y = PyArray_MultiIter_DATA(multi, 2) * z = PyArray_MultiIter_DATA(multi, 3) * t = PyArray_MultiIter_DATA(multi, 4) # <<<<<<<<<<<<<< @@ -2446,7 +2646,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_t = ((double *)PyArray_MultiIter_DATA(__pyx_v_multi, 4)); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":166 + /* "nipy/algorithms/registration/_registration.pyx":166 * z = PyArray_MultiIter_DATA(multi, 3) * t = PyArray_MultiIter_DATA(multi, 4) * r[0] = cubic_spline_sample4d(x[0], y[0], z[0], t[0], C, modes[mx], modes[my], modes[mz], modes[mt]) # <<<<<<<<<<<<<< @@ -2483,7 +2683,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; (__pyx_v_r[0]) = cubic_spline_sample4d((__pyx_v_x[0]), (__pyx_v_y[0]), (__pyx_v_z[0]), (__pyx_v_t[0]), __pyx_v_C, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":167 + /* "nipy/algorithms/registration/_registration.pyx":167 * t = PyArray_MultiIter_DATA(multi, 4) * r[0] = cubic_spline_sample4d(x[0], y[0], z[0], t[0], C, modes[mx], modes[my], modes[mz], modes[mt]) * PyArray_MultiIter_NEXT(multi) # <<<<<<<<<<<<<< @@ -2493,7 +2693,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyArray_MultiIter_NEXT(__pyx_v_multi); } - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":168 + /* "nipy/algorithms/registration/_registration.pyx":168 * r[0] = cubic_spline_sample4d(x[0], y[0], z[0], t[0], C, modes[mx], modes[my], modes[mz], modes[mt]) * PyArray_MultiIter_NEXT(multi) * return R # <<<<<<<<<<<<<< @@ -2511,20 +2711,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample4d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_sample4d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_multi); - __Pyx_DECREF((PyObject *)__pyx_v_Xa); - __Pyx_DECREF((PyObject *)__pyx_v_Ya); - __Pyx_DECREF((PyObject *)__pyx_v_Za); - __Pyx_DECREF((PyObject *)__pyx_v_Ta); + __Pyx_XDECREF((PyObject *)__pyx_v_multi); + __Pyx_XDECREF((PyObject *)__pyx_v_Xa); + __Pyx_XDECREF((PyObject *)__pyx_v_Ya); + __Pyx_XDECREF((PyObject *)__pyx_v_Za); + __Pyx_XDECREF((PyObject *)__pyx_v_Ta); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":171 +/* "nipy/algorithms/registration/_registration.pyx":171 * * * def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, # <<<<<<<<<<<<<< @@ -2532,9 +2732,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * """ */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration__cspline_resample3d[] = "\n Note that the input transformation Tvox will be re-ordered in C\n convention if needed.\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d[] = "\n Note that the input transformation Tvox will be re-ordered in C\n convention if needed.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d = {__Pyx_NAMESTR("_cspline_resample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_im = 0; PyObject *__pyx_v_dims = 0; PyArrayObject *__pyx_v_Tvox = 0; @@ -2544,8 +2745,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp PyObject *__pyx_v_mz = 0; double *__pyx_v_tvox; int __pyx_v_cast_integer; - PyObject *__pyx_v_im_resampled; + PyObject *__pyx_v_im_resampled = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; @@ -2554,68 +2756,86 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__dims,&__pyx_n_s__Tvox,&__pyx_n_s__dtype,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; __Pyx_RefNannySetupContext("_cspline_resample3d"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[7] = {0,0,0,0,0,0,0}; values[3] = ((PyObject *)Py_None); values[4] = ((PyObject *)__pyx_n_s__zero); values[5] = ((PyObject *)__pyx_n_s__zero); values[6] = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__im); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype); - if (value) { values[3] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); - if (value) { values[4] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__im); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dtype); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mx); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); + if (value) { values[6] = value; kw_args--; } + } } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__my); - if (value) { values[5] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_resample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mz); - if (value) { values[6] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_resample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_im = ((PyArrayObject *)values[0]); __pyx_v_dims = values[1]; __pyx_v_Tvox = ((PyArrayObject *)values[2]); @@ -2623,43 +2843,21 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __pyx_v_mx = values[4]; __pyx_v_my = values[5]; __pyx_v_mz = values[6]; - } else { - __pyx_v_dtype = ((PyObject *)Py_None); - __pyx_v_mx = ((PyObject *)__pyx_n_s__zero); - __pyx_v_my = ((PyObject *)__pyx_n_s__zero); - __pyx_v_mz = ((PyObject *)__pyx_n_s__zero); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: - __pyx_v_mz = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: - __pyx_v_my = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: - __pyx_v_mx = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_dtype = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: - __pyx_v_Tvox = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_dims = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_im = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_resample3d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_resample3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_INCREF((PyObject *)__pyx_v_Tvox); __Pyx_INCREF(__pyx_v_dtype); - __pyx_v_im_resampled = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_im), __pyx_ptype_5numpy_ndarray, 1, "im", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Tvox), __pyx_ptype_5numpy_ndarray, 1, "Tvox", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":181 + /* "nipy/algorithms/registration/_registration.pyx":181 * * # Create output array * if dtype == None: # <<<<<<<<<<<<<< @@ -2672,7 +2870,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":182 + /* "nipy/algorithms/registration/_registration.pyx":182 * # Create output array * if dtype == None: * dtype = im.dtype # <<<<<<<<<<<<<< @@ -2688,7 +2886,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp } __pyx_L6:; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":183 + /* "nipy/algorithms/registration/_registration.pyx":183 * if dtype == None: * dtype = im.dtype * im_resampled = np.zeros(tuple(dims), dtype=dtype) # <<<<<<<<<<<<<< @@ -2701,31 +2899,30 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_dims); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_im_resampled); __pyx_v_im_resampled = __pyx_t_5; __pyx_t_5 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":187 + /* "nipy/algorithms/registration/_registration.pyx":187 * # Ensure that the Tvox array is C-contiguous (required by the * # underlying C routine) * Tvox = np.asarray(Tvox, dtype='double', order='C') # <<<<<<<<<<<<<< @@ -2738,7 +2935,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_INCREF(((PyObject *)__pyx_v_Tvox)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Tvox)); __Pyx_GIVEREF(((PyObject *)__pyx_v_Tvox)); @@ -2746,17 +2943,17 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__double)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_5, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_Tvox)); __pyx_v_Tvox = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":188 + /* "nipy/algorithms/registration/_registration.pyx":188 * # underlying C routine) * Tvox = np.asarray(Tvox, dtype='double', order='C') * tvox = Tvox.data # <<<<<<<<<<<<<< @@ -2765,79 +2962,109 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp */ __pyx_v_tvox = ((double *)__pyx_v_Tvox->data); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":191 + /* "nipy/algorithms/registration/_registration.pyx":191 * * # Actual resampling - * cast_integer = np.issubdtype(dtype, np.integer) # <<<<<<<<<<<<<< - * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, - * modes[mx], modes[my], modes[mz]) + * if dtype.kind == 'i': # <<<<<<<<<<<<<< + * cast_integer = 1 + * elif dtype.kind == 'u': */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__issubdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__integer); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dtype); - __Pyx_GIVEREF(__pyx_v_dtype); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_cast_integer = __pyx_t_6; + if (__pyx_t_2) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":192 + /* "nipy/algorithms/registration/_registration.pyx":192 * # Actual resampling - * cast_integer = np.issubdtype(dtype, np.integer) - * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, # <<<<<<<<<<<<<< - * modes[mx], modes[my], modes[mz]) - * + * if dtype.kind == 'i': + * cast_integer = 1 # <<<<<<<<<<<<<< + * elif dtype.kind == 'u': + * cast_integer = 2 */ - if (!(likely(((__pyx_v_im_resampled) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_im_resampled, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_cast_integer = 1; + goto __pyx_L7; + } - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":193 - * cast_integer = np.issubdtype(dtype, np.integer) - * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, - * modes[mx], modes[my], modes[mz]) # <<<<<<<<<<<<<< - * - * return im_resampled + /* "nipy/algorithms/registration/_registration.pyx":193 + * if dtype.kind == 'i': + * cast_integer = 1 + * elif dtype.kind == 'u': # <<<<<<<<<<<<<< + * cast_integer = 2 + * else: */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_v_mx); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__u), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_v_my); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_2) { + + /* "nipy/algorithms/registration/_registration.pyx":194 + * cast_integer = 1 + * elif dtype.kind == 'u': + * cast_integer = 2 # <<<<<<<<<<<<<< + * else: + * cast_integer = 0 + */ + __pyx_v_cast_integer = 2; + goto __pyx_L7; + } + /*else*/ { + + /* "nipy/algorithms/registration/_registration.pyx":196 + * cast_integer = 2 + * else: + * cast_integer = 0 # <<<<<<<<<<<<<< + * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, + * modes[mx], modes[my], modes[mz]) + */ + __pyx_v_cast_integer = 0; + } + __pyx_L7:; + + /* "nipy/algorithms/registration/_registration.pyx":197 + * else: + * cast_integer = 0 + * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, # <<<<<<<<<<<<<< + * modes[mx], modes[my], modes[mz]) + * + */ + if (!(likely(((__pyx_v_im_resampled) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_im_resampled, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_v_im_resampled; + __Pyx_INCREF(__pyx_t_3); + + /* "nipy/algorithms/registration/_registration.pyx":198 + * cast_integer = 0 + * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, + * modes[mx], modes[my], modes[mz]) # <<<<<<<<<<<<<< + * + * return im_resampled + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetItem(__pyx_t_5, __pyx_v_mz); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_v_my); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mz); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + cubic_spline_resample3d(((PyArrayObject *)__pyx_t_3), __pyx_v_im, __pyx_v_tvox, __pyx_v_cast_integer, __pyx_t_6, __pyx_t_7, __pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - cubic_spline_resample3d(((PyArrayObject *)__pyx_v_im_resampled), __pyx_v_im, __pyx_v_tvox, __pyx_v_cast_integer, __pyx_t_6, __pyx_t_7, __pyx_t_8); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":195 + /* "nipy/algorithms/registration/_registration.pyx":200 * modes[mx], modes[my], modes[mz]) * * return im_resampled # <<<<<<<<<<<<<< @@ -2856,18 +3083,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_resample3d"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._cspline_resample3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_im_resampled); - __Pyx_DECREF((PyObject *)__pyx_v_Tvox); - __Pyx_DECREF(__pyx_v_dtype); + __Pyx_XDECREF(__pyx_v_im_resampled); + __Pyx_XDECREF((PyObject *)__pyx_v_Tvox); + __Pyx_XDECREF(__pyx_v_dtype); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":198 +/* "nipy/algorithms/registration/_registration.pyx":203 * * * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< @@ -2875,105 +3102,110 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__csp * raise ValueError('%s array should be double C-contiguous' % xname) */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_8check_array = {__Pyx_NAMESTR("check_array"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x = 0; int __pyx_v_dim; int __pyx_v_exp_dim; PyObject *__pyx_v_xname = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; int __pyx_t_4; int __pyx_t_5; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__dim,&__pyx_n_s__exp_dim,&__pyx_n_s__xname,0}; __Pyx_RefNannySetupContext("check_array"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exp_dim); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exp_dim); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xname); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xname); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "check_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "check_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_dim = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_exp_dim = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_exp_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dim = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_exp_dim = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_exp_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_xname = values[3]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_x = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_dim = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_exp_dim = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_exp_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_xname = PyTuple_GET_ITEM(__pyx_args, 3); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration.check_array"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration.check_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":199 + /* "nipy/algorithms/registration/_registration.pyx":204 * * def check_array(ndarray x, int dim, int exp_dim, xname): * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': # <<<<<<<<<<<<<< * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (!__pyx_t_4) { - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -2981,31 +3213,31 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_chec } if (__pyx_t_3) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":200 + /* "nipy/algorithms/registration/_registration.pyx":205 * def check_array(ndarray x, int dim, int exp_dim, xname): * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': * raise ValueError('%s array should be double C-contiguous' % xname) # <<<<<<<<<<<<<< * if not dim == exp_dim: * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) */ - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_v_xname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_xname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":201 + /* "nipy/algorithms/registration/_registration.pyx":206 * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: # <<<<<<<<<<<<<< @@ -3015,42 +3247,42 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_chec __pyx_t_3 = (!(__pyx_v_dim == __pyx_v_exp_dim)); if (__pyx_t_3) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":202 + /* "nipy/algorithms/registration/_registration.pyx":207 * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) # <<<<<<<<<<<<<< * * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_exp_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyInt_FromLong(__pyx_v_exp_dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_xname); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xname); __Pyx_GIVEREF(__pyx_v_xname); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; @@ -3061,7 +3293,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_chec __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("nipy.algorithms.registration._registration.check_array"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration.check_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3069,7 +3301,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_chec return __pyx_r; } -/* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":204 +/* "nipy/algorithms/registration/_registration.pyx":209 * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) * * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< @@ -3077,96 +3309,104 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_chec * check_array(xyz, xyz.shape[1], 3, 'xyz') */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine = {__Pyx_NAMESTR("_apply_polyaffine"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_xyz = 0; PyArrayObject *__pyx_v_centers = 0; PyArrayObject *__pyx_v_affines = 0; PyArrayObject *__pyx_v_sigma = 0; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__xyz,&__pyx_n_s__centers,&__pyx_n_s__affines,&__pyx_n_s__sigma,0}; __Pyx_RefNannySetupContext("_apply_polyaffine"); __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + { PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xyz); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__affines); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xyz); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__affines); + if (likely(values[2])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma); + if (likely(values[3])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_apply_polyaffine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_apply_polyaffine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_xyz = ((PyArrayObject *)values[0]); __pyx_v_centers = ((PyArrayObject *)values[1]); __pyx_v_affines = ((PyArrayObject *)values[2]); __pyx_v_sigma = ((PyArrayObject *)values[3]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_xyz = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_centers = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_affines = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_sigma = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.registration._registration._apply_polyaffine"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._apply_polyaffine", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_affines), __pyx_ptype_5numpy_ndarray, 1, "affines", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sigma), __pyx_ptype_5numpy_ndarray, 1, "sigma", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_affines), __pyx_ptype_5numpy_ndarray, 1, "affines", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sigma), __pyx_ptype_5numpy_ndarray, 1, "sigma", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":206 + /* "nipy/algorithms/registration/_registration.pyx":211 * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): * * check_array(xyz, xyz.shape[1], 3, 'xyz') # <<<<<<<<<<<<<< * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xyz->dimensions[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xyz->dimensions[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_xyz)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_xyz)); __Pyx_GIVEREF(((PyObject *)__pyx_v_xyz)); @@ -3179,25 +3419,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__xyz)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xyz)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":207 + /* "nipy/algorithms/registration/_registration.pyx":212 * * check_array(xyz, xyz.shape[1], 3, 'xyz') * check_array(centers, centers.shape[1], 3, 'centers') # <<<<<<<<<<<<<< * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_centers->dimensions[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_centers->dimensions[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_centers)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_centers)); __Pyx_GIVEREF(((PyObject *)__pyx_v_centers)); @@ -3210,25 +3450,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__centers)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__centers)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":208 + /* "nipy/algorithms/registration/_registration.pyx":213 * check_array(xyz, xyz.shape[1], 3, 'xyz') * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') # <<<<<<<<<<<<<< * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_affines->dimensions[1])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_affines->dimensions[1])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_affines)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_affines)); __Pyx_GIVEREF(((PyObject *)__pyx_v_affines)); @@ -3241,25 +3481,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__affines)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__affines)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":209 + /* "nipy/algorithms/registration/_registration.pyx":214 * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') # <<<<<<<<<<<<<< * if not centers.shape[0] == affines.shape[0]: * raise ValueError('centers and affines arrays should have same shape[0]') */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sigma), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sigma), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_sigma)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_sigma)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sigma)); @@ -3272,13 +3512,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__sigma)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sigma)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":210 + /* "nipy/algorithms/registration/_registration.pyx":215 * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: # <<<<<<<<<<<<<< @@ -3288,29 +3528,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app __pyx_t_4 = (!((__pyx_v_centers->dimensions[0]) == (__pyx_v_affines->dimensions[0]))); if (__pyx_t_4) { - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":211 + /* "nipy/algorithms/registration/_registration.pyx":216 * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: * raise ValueError('centers and affines arrays should have same shape[0]') # <<<<<<<<<<<<<< * * apply_polyaffine(xyz, centers, affines, sigma) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":213 + /* "nipy/algorithms/registration/_registration.pyx":218 * raise ValueError('centers and affines arrays should have same shape[0]') * * apply_polyaffine(xyz, centers, affines, sigma) # <<<<<<<<<<<<<< @@ -3323,7 +3557,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("nipy.algorithms.registration._registration._apply_polyaffine"); + __Pyx_AddTraceback("nipy.algorithms.registration._registration._apply_polyaffine", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3331,7 +3565,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__app return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 +/* "numpy.pxd":190 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -3352,22 +3586,42 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":196 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":199 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -3375,7 +3629,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + /* "numpy.pxd":200 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3384,7 +3638,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 + /* "numpy.pxd":202 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -3393,7 +3647,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":204 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3403,7 +3657,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 + /* "numpy.pxd":205 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3411,11 +3665,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L6; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 + /* "numpy.pxd":207 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3424,9 +3678,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":209 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3436,7 +3690,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":210 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3450,29 +3704,23 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 + /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L6:; + __pyx_L7:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":213 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3482,7 +3730,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3496,29 +3744,23 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L7:; + __pyx_L8:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -3527,54 +3769,54 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":218 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 + /* "numpy.pxd":219 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ if (__pyx_v_copy_shape) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":222 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":223 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":224 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":225 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -3583,7 +3825,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + /* "numpy.pxd":226 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -3592,11 +3834,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L9; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":228 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -3605,7 +3847,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":229 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -3614,9 +3856,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); } - __pyx_L8:; + __pyx_L9:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":230 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3625,7 +3867,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":231 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -3634,7 +3876,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + /* "numpy.pxd":232 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -3643,7 +3885,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":235 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3652,7 +3894,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + /* "numpy.pxd":236 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -3662,7 +3904,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + /* "numpy.pxd":240 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3671,7 +3913,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + /* "numpy.pxd":242 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3687,7 +3929,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 + /* "numpy.pxd":244 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3699,11 +3941,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L12; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 + /* "numpy.pxd":247 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -3716,9 +3958,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } - __pyx_L11:; + __pyx_L12:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":249 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -3728,7 +3970,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":250 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -3737,7 +3979,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":251 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -3752,7 +3994,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "numpy.pxd":252 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -3762,39 +4004,33 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; } - __pyx_L13:; + __pyx_L14:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":254 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -3804,10 +4040,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":255 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3817,10 +4053,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":256 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3830,10 +4066,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":257 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3843,10 +4079,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":258 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3856,10 +4092,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":259 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3869,10 +4105,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":260 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3882,10 +4118,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":261 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3895,10 +4131,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":262 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3908,10 +4144,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":263 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3921,10 +4157,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":264 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3934,10 +4170,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":265 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3947,10 +4183,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":266 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3960,10 +4196,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":267 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3973,10 +4209,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":268 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3986,10 +4222,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":269 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3999,10 +4235,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L15; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 + /* "numpy.pxd":270 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4012,37 +4248,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L15; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":272 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L15:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":273 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -4051,7 +4287,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 + /* "numpy.pxd":274 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -4060,11 +4296,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L13; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":276 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -4073,7 +4309,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":277 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -4082,7 +4318,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ (__pyx_v_info->format[0]) = '^'; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 + /* "numpy.pxd":278 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -4091,17 +4327,17 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_offset = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":281 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 + /* "numpy.pxd":282 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -4110,20 +4346,22 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ (__pyx_v_f[0]) = 0; } - __pyx_L12:; + __pyx_L13:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } @@ -4133,7 +4371,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 +/* "numpy.pxd":284 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -4141,12 +4379,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * stdlib.free(info.format) */ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":285 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -4156,7 +4395,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *_ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":286 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4168,7 +4407,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *_ } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":287 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4178,7 +4417,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 + /* "numpy.pxd":288 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4193,7 +4432,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *_ __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 +/* "numpy.pxd":764 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4203,10 +4442,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *_ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + /* "numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -4214,7 +4457,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4224,7 +4467,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4232,7 +4475,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 +/* "numpy.pxd":767 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4242,10 +4485,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 + /* "numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -4253,7 +4500,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 760; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4263,7 +4510,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4271,7 +4518,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 +/* "numpy.pxd":770 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4281,10 +4528,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 + /* "numpy.pxd":771 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -4292,7 +4543,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4302,7 +4553,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4310,7 +4561,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 +/* "numpy.pxd":773 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -4320,10 +4571,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 + /* "numpy.pxd":774 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -4331,7 +4586,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4341,7 +4596,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4349,7 +4604,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 +/* "numpy.pxd":776 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4359,10 +4614,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 + /* "numpy.pxd":777 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -4370,7 +4629,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4380,7 +4639,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4388,7 +4647,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 +/* "numpy.pxd":779 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -4397,16 +4656,17 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; @@ -4414,15 +4674,14 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring"); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":786 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4431,7 +4690,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 + /* "numpy.pxd":787 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4440,110 +4699,110 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":790 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":791 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 + /* "numpy.pxd":792 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":794 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 + /* "numpy.pxd":795 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":797 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -4558,7 +4817,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (!__pyx_t_7) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + /* "numpy.pxd":798 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -4578,29 +4837,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx } if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 + /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":809 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4608,16 +4861,16 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":810 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4626,35 +4879,37 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":811 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 + /* "numpy.pxd":812 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 + /* "numpy.pxd":814 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":816 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -4664,20 +4919,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":817 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":818 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -4687,408 +4942,402 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 + /* "numpy.pxd":819 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":822 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":823 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":824 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":825 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":826 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":827 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":828 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":829 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":830 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":831 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":832 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":833 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":834 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":835 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":836 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":837 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L11; } - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 + /* "numpy.pxd":838 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; goto __pyx_L11; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":840 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 + /* "numpy.pxd":841 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); goto __pyx_L9; } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":845 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; } __pyx_L9:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 + /* "numpy.pxd":846 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -5101,23 +5350,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 +/* "numpy.pxd":961 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5127,10 +5376,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":963 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5140,7 +5390,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 + /* "numpy.pxd":964 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5152,7 +5402,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":966 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5161,7 +5411,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":967 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -5172,7 +5422,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":968 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5181,7 +5431,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 + /* "numpy.pxd":969 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5193,7 +5443,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 +/* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5203,10 +5453,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":972 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5216,7 +5467,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 + /* "numpy.pxd":973 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5231,7 +5482,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 + /* "numpy.pxd":975 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -5251,16 +5502,6 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("_joint_histogram"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram)}, - {__Pyx_NAMESTR("_L1_moments"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__L1_moments, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__L1_moments)}, - {__Pyx_NAMESTR("_cspline_transform"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_transform, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_cspline_sample1d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_cspline_sample2d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_cspline_sample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_cspline_sample4d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_sample4d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__cspline_sample4d)}, - {__Pyx_NAMESTR("_cspline_resample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__cspline_resample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__cspline_resample3d)}, - {__Pyx_NAMESTR("check_array"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_check_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_apply_polyaffine"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__apply_polyaffine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -5268,7 +5509,7 @@ static PyMethodDef __pyx_methods[] = { static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("_registration"), - __Pyx_DOCSTR(__pyx_k_12), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_21), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -5280,20 +5521,17 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, - {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, - {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, + {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, + {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__C_CONTIGUOUS, __pyx_k__C_CONTIGUOUS, sizeof(__pyx_k__C_CONTIGUOUS), 0, 0, 1, 1}, @@ -5310,58 +5548,48 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, + {&__pyx_n_s___apply_polyaffine, __pyx_k___apply_polyaffine, sizeof(__pyx_k___apply_polyaffine), 0, 0, 1, 1}, {&__pyx_n_s___cspline_resample3d, __pyx_k___cspline_resample3d, sizeof(__pyx_k___cspline_resample3d), 0, 0, 1, 1}, + {&__pyx_n_s___cspline_sample1d, __pyx_k___cspline_sample1d, sizeof(__pyx_k___cspline_sample1d), 0, 0, 1, 1}, + {&__pyx_n_s___cspline_sample2d, __pyx_k___cspline_sample2d, sizeof(__pyx_k___cspline_sample2d), 0, 0, 1, 1}, + {&__pyx_n_s___cspline_sample3d, __pyx_k___cspline_sample3d, sizeof(__pyx_k___cspline_sample3d), 0, 0, 1, 1}, {&__pyx_n_s___cspline_sample4d, __pyx_k___cspline_sample4d, sizeof(__pyx_k___cspline_sample4d), 0, 0, 1, 1}, + {&__pyx_n_s___cspline_transform, __pyx_k___cspline_transform, sizeof(__pyx_k___cspline_transform), 0, 0, 1, 1}, {&__pyx_n_s___joint_histogram, __pyx_k___joint_histogram, sizeof(__pyx_k___joint_histogram), 0, 0, 1, 1}, {&__pyx_n_s__affines, __pyx_k__affines, sizeof(__pyx_k__affines), 0, 0, 1, 1}, {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__centers, __pyx_k__centers, sizeof(__pyx_k__centers), 0, 0, 1, 1}, {&__pyx_n_s__check_array, __pyx_k__check_array, sizeof(__pyx_k__check_array), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, {&__pyx_n_s__dim, __pyx_k__dim, sizeof(__pyx_k__dim), 0, 0, 1, 1}, {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__exp_dim, __pyx_k__exp_dim, sizeof(__pyx_k__exp_dim), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__im, __pyx_k__im, sizeof(__pyx_k__im), 0, 0, 1, 1}, {&__pyx_n_s__imJ, __pyx_k__imJ, sizeof(__pyx_k__imJ), 0, 0, 1, 1}, {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, - {&__pyx_n_s__integer, __pyx_k__integer, sizeof(__pyx_k__integer), 0, 0, 1, 1}, {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, - {&__pyx_n_s__issubdtype, __pyx_k__issubdtype, sizeof(__pyx_k__issubdtype), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, {&__pyx_n_s__iterI, __pyx_k__iterI, sizeof(__pyx_k__iterI), 0, 0, 1, 1}, + {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1}, {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, {&__pyx_n_s__modes, __pyx_k__modes, sizeof(__pyx_k__modes), 0, 0, 1, 1}, {&__pyx_n_s__mt, __pyx_k__mt, sizeof(__pyx_k__mt), 0, 0, 1, 1}, {&__pyx_n_s__mx, __pyx_k__mx, sizeof(__pyx_k__mx), 0, 0, 1, 1}, {&__pyx_n_s__my, __pyx_k__my, sizeof(__pyx_k__my), 0, 0, 1, 1}, {&__pyx_n_s__mz, __pyx_k__mz, sizeof(__pyx_k__mz), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__nearest, __pyx_k__nearest, sizeof(__pyx_k__nearest), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, {&__pyx_n_s__reflect, __pyx_k__reflect, sizeof(__pyx_k__reflect), 0, 0, 1, 1}, {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__sigma, __pyx_k__sigma, sizeof(__pyx_k__sigma), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {&__pyx_n_s__xname, __pyx_k__xname, sizeof(__pyx_k__xname), 0, 0, 1, 1}, {&__pyx_n_s__xyz, __pyx_k__xyz, sizeof(__pyx_k__xyz), 0, 0, 1, 1}, @@ -5372,26 +5600,162 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); -#if PY_MAJOR_VERSION < 3 + /* "nipy/algorithms/registration/_registration.pyx":73 + * ret = joint_histogram(H, clampI, clampJ, iterI, imJ, Tvox, interp) + * if not ret == 0: + * raise RuntimeError('Joint histogram failed because of incorrect input arrays.') # <<<<<<<<<<<<<< + * + * return + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "nipy/algorithms/registration/_registration.pyx":89 + * ret = L1_moments(n, median, dev, H) + * if not ret == 0: + * raise RuntimeError('L1_moments failed because input array is not double.') # <<<<<<<<<<<<<< + * + * return n[0], median[0], dev[0] + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "nipy/algorithms/registration/_registration.pyx":216 + * check_array(sigma, sigma.size, 3, 'sigma') + * if not centers.shape[0] == affines.shape[0]: + * raise ValueError('centers and affines arrays should have same shape[0]') # <<<<<<<<<<<<<< + * + * apply_polyaffine(xyz, centers, affines, sigma) + */ + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); + PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_12 = PyInt_FromLong(12); if (unlikely(!__pyx_int_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC init_registration(void); /*proto*/ PyMODINIT_FUNC init_registration(void) #else @@ -5400,10 +5764,8 @@ PyMODINIT_FUNC PyInit__registration(void) #endif { PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -5411,8 +5773,9 @@ PyMODINIT_FUNC PyInit__registration(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__registration(void)", __LINE__, __FILE__); #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__registration(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __pyx_binding_PyCFunctionType_USED @@ -5427,7 +5790,7 @@ PyMODINIT_FUNC PyInit__registration(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_registration"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_12), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_registration"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_21), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -5445,28 +5808,32 @@ PyMODINIT_FUNC PyInit__registration(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":9 + /* "nipy/algorithms/registration/_registration.pyx":9 * """ * * __version__ = '0.3' # <<<<<<<<<<<<<< * * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_13)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_22)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":47 + /* "nipy/algorithms/registration/_registration.pyx":47 * * # Initialize numpy * joint_histogram_import_array() # <<<<<<<<<<<<<< @@ -5475,7 +5842,7 @@ PyMODINIT_FUNC PyInit__registration(void) */ joint_histogram_import_array(); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":48 + /* "nipy/algorithms/registration/_registration.pyx":48 * # Initialize numpy * joint_histogram_import_array() * cubic_spline_import_array() # <<<<<<<<<<<<<< @@ -5484,7 +5851,7 @@ PyMODINIT_FUNC PyInit__registration(void) */ cubic_spline_import_array(); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":49 + /* "nipy/algorithms/registration/_registration.pyx":49 * joint_histogram_import_array() * cubic_spline_import_array() * polyaffine_import_array() # <<<<<<<<<<<<<< @@ -5493,7 +5860,7 @@ PyMODINIT_FUNC PyInit__registration(void) */ polyaffine_import_array(); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":50 + /* "nipy/algorithms/registration/_registration.pyx":50 * cubic_spline_import_array() * polyaffine_import_array() * import_array() # <<<<<<<<<<<<<< @@ -5502,19 +5869,19 @@ PyMODINIT_FUNC PyInit__registration(void) */ import_array(); - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":51 + /* "nipy/algorithms/registration/_registration.pyx":51 * polyaffine_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * # Globals */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":54 + /* "nipy/algorithms/registration/_registration.pyx":54 * * # Globals * modes = {'zero': 0, 'nearest': 1, 'reflect': 2} # <<<<<<<<<<<<<< @@ -5529,45 +5896,137 @@ PyMODINIT_FUNC PyInit__registration(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__modes, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx":1 + /* "nipy/algorithms/registration/_registration.pyx":57 + * + * + * def _joint_histogram(ndarray H, flatiter iterI, ndarray imJ, ndarray Tvox, long interp): # <<<<<<<<<<<<<< + * """ + * Compute the joint histogram given a transformation trial. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration__joint_histogram, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___joint_histogram, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":78 + * + * + * def _L1_moments(ndarray H): # <<<<<<<<<<<<<< + * """ + * Compute L1 moments of order 0, 1 and 2 of a one-dimensional + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_L1_moments, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___L1_moments, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":94 + * + * + * def _cspline_transform(ndarray x): # <<<<<<<<<<<<<< + * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) + * cubic_spline_transform(c, x) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_2_cspline_transform, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_transform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":103 + * return np.reshape(in_arr, shape).astype(np.double) + * + * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): # <<<<<<<<<<<<<< + * cdef double *r, *x + * cdef broadcast multi + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":115 + * return R + * + * def _cspline_sample2d(ndarray R, ndarray C, X=0, Y=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero'): + * cdef double *r, *x, *y + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":130 + * return R + * + * def _cspline_sample3d(ndarray R, ndarray C, X=0, Y=0, Z=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * cdef double *r, *x, *y, *z + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":148 + * + * + * def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero', mt='zero'): + * """ + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample4d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":171 + * + * + * def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * """ + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_resample3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":203 + * + * + * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< + * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': + * raise ValueError('%s array should be double C-contiguous' % xname) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_8check_array, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__check_array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":209 + * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) + * + * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< + * + * check_array(xyz, xyz.shape[1], 3, 'xyz') + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___apply_polyaffine, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/registration/_registration.pyx":1 * # -*- Mode: Python -*- # <<<<<<<<<<<<<< * * """ */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s___joint_histogram); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_14), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s___L1_moments); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_15), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s___cspline_sample4d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_16), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s___cspline_resample3d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_17), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":971 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5577,10 +6036,8 @@ PyMODINIT_FUNC PyInit__registration(void) goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.algorithms.registration._registration"); + __Pyx_AddTraceback("init nipy.algorithms.registration._registration", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.algorithms.registration._registration"); @@ -5596,27 +6053,37 @@ PyMODINIT_FUNC PyInit__registration(void) /* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } return result; } -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, @@ -5625,7 +6092,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; @@ -5637,14 +6104,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -5746,84 +6222,6 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed return 0; } -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "too many values to unpack (expected %d)", (int)expected); - #else - "too many values to unpack (expected %zd)", expected); - #endif -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(index); - } -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *py_import = 0; - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!py_import) - goto bad; - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; - } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); -bad: - Py_XDECREF(empty_list); - Py_XDECREF(py_import); - Py_XDECREF(empty_dict); - return module; -} - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -5852,7 +6250,8 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); @@ -5919,7 +6318,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { #else /* Python 3+ */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -5944,6 +6343,29 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { goto bad; } + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); if (tb) { @@ -5961,6 +6383,91 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { } #endif +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; const int is_unsigned = const_zero < neg_one; @@ -5981,11 +6488,73 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { } else { int one = 1; int little = (int)*(unsigned char *)&one; unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), little, !is_unsigned); } } +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { + if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyBytes_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); + else + return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); + } else { + int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { + if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ + return (equals == Py_EQ); + } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { + if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { + return (equals == Py_NE); + } else if (PyUnicode_GET_SIZE(s1) == 1) { + if (equals == Py_EQ) + return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); + else + return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); + } else { + int result = PyUnicode_Compare(s1, s2); + if ((result == -1) && unlikely(PyErr_Occurred())) + return -1; + return (equals == Py_EQ) ? (result == 0) : (result != 0); + } + } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { + return (equals == Py_NE); + } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { + return (equals == Py_NE); + } else { + int result; + PyObject* py_result = PyObject_RichCompare(s1, s2, equals); + if (!py_result) + return -1; + result = __Pyx_PyObject_IsTrue(py_result); + Py_DECREF(py_result); + return result; + } +} + #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -6050,15 +6619,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -6125,15 +6739,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -6347,9 +7006,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -6382,9 +7041,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -6417,9 +7076,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -6452,9 +7111,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -6487,9 +7146,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -6522,9 +7181,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -6536,10 +7195,29 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; @@ -6564,23 +7242,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); #if PY_VERSION_HEX < 0x02050000 - PyErr_Warn(NULL, warning); + if (PyErr_Warn(NULL, warning) < 0) goto bad; #else - PyErr_WarnEx(NULL, warning, 0); + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -6589,7 +7267,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif @@ -6619,7 +7297,8 @@ static PyObject *__Pyx_ImportModule(const char *name) { #include "frameobject.h" #include "traceback.h" -static void __Pyx_AddTraceback(const char *funcname) { +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; diff --git a/nipy/algorithms/registration/_registration.pyx b/nipy/algorithms/registration/_registration.pyx index 62c84f6374..d3cd6e90c4 100644 --- a/nipy/algorithms/registration/_registration.pyx +++ b/nipy/algorithms/registration/_registration.pyx @@ -188,7 +188,12 @@ def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, tvox = Tvox.data # Actual resampling - cast_integer = np.issubdtype(dtype, np.integer) + if dtype.kind == 'i': + cast_integer = 1 + elif dtype.kind == 'u': + cast_integer = 2 + else: + cast_integer = 0 cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, modes[mx], modes[my], modes[mz]) diff --git a/nipy/algorithms/registration/cubic_spline.c b/nipy/algorithms/registration/cubic_spline.c index 1f742fef5a..4e84b88c05 100644 --- a/nipy/algorithms/registration/cubic_spline.c +++ b/nipy/algorithms/registration/cubic_spline.c @@ -588,8 +588,12 @@ void cubic_spline_resample3d(PyArrayObject* im_resampled, const PyArrayObject* i z = imIter->coordinates[2]; _apply_affine_transform(&Tx, &Ty, &Tz, Tvox, x, y, z); i1 = cubic_spline_sample3d(Tx, Ty, Tz, im_spline_coeff, mode_x, mode_y, mode_z); - if (cast_integer) - i1 = ROUND(i1); + if (cast_integer) { + i1 = ROUND(i1); + if (cast_integer == 2) + if (i1 < 0) + i1 = 0; + } /* Copy interpolated value into numpy array */ py_i1 = PyFloat_FromDouble(i1); From 1ae8a545858b2dc3d97085709318c86183b82b17 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Wed, 10 Oct 2012 13:51:09 +0200 Subject: [PATCH 002/164] update docstring for cubic spline resampling pyx function --- nipy/algorithms/registration/_registration.pyx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/registration/_registration.pyx b/nipy/algorithms/registration/_registration.pyx index d3cd6e90c4..120ba81acc 100644 --- a/nipy/algorithms/registration/_registration.pyx +++ b/nipy/algorithms/registration/_registration.pyx @@ -171,8 +171,18 @@ def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, mx='zero', my='zero', mz='zero'): """ - Note that the input transformation Tvox will be re-ordered in C - convention if needed. + Perform cubic spline resampling of a 3d input image `im` into a + grid with shape `dims` according to an affine transform + represented by a 4x4 matrix `Tvox` that assumes voxel + coordinates. Boundary conditions on each axis are determined by + the keyword arguments `mx`, `my` and `mz`, respectively. Possible + choices are: + + 'zero': assume zero intensity outside the target grid + 'nearest': extrapolate intensity by the closest grid point along the axis + 'reflect': extrapolate intensity by mirroring the input image along the axis + + Note that `Tvox` will be re-ordered in C convention if needed. """ cdef double *tvox cdef int cast_integer From 5ca0c1d4de870354b5b51b70fc42a73007fba8eb Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Wed, 10 Oct 2012 14:11:43 +0200 Subject: [PATCH 003/164] additional tests for resampling --- .../registration/tests/test_resample.py | 34 ++++++++++++++----- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/nipy/algorithms/registration/tests/test_resample.py b/nipy/algorithms/registration/tests/test_resample.py index 66504316f8..5ba83ef526 100644 --- a/nipy/algorithms/registration/tests/test_resample.py +++ b/nipy/algorithms/registration/tests/test_resample.py @@ -12,15 +12,31 @@ from numpy.testing import assert_array_almost_equal -def test_resample(): +def _test_resample(arr, interp_orders): # Check basic cases of resampling - arr = np.random.rand(10, 11, 12) img = Image(arr, vox2mni(np.eye(4))) T = Affine() - img2 = resample(img, T, interp_order=0) - assert_array_almost_equal(img2.get_data(), img.get_data()) - img2 = resample(img, T, img) - assert_array_almost_equal(img2.get_data(), img.get_data()) - img_aff = as_xyz_image(img) - img2 = resample(img, T, reference=(img_aff.shape, xyz_affine(img_aff))) - assert_array_almost_equal(img2.get_data(), img.get_data()) + for i in interp_orders: + img2 = resample(img, T, interp_order=i) + assert_array_almost_equal(img2.get_data(), img.get_data()) + img_aff = as_xyz_image(img) + img2 = resample(img, T, reference=(img_aff.shape, xyz_affine(img_aff)), + interp_order=i) + assert_array_almost_equal(img2.get_data(), img.get_data()) + + +def test_resample_float_data(): + arr = np.random.rand(10, 11, 12) + _test_resample(arr, (0, 1, 3, 5)) + +def test_resample_int_data(): + arr = np.random.randint(100, size=(10, 11, 12)) - 50 + _test_resample(arr, (3,)) + +def test_resample_uint_data(): + arr = np.random.randint(100, size=(10, 11, 12)).astype('uint') + img = Image(arr, vox2mni(np.eye(4))) + T = Affine((.5, .5, .5, .1, .1, .1, 0, 0, 0, 0, 0, 0)) + img2 = resample(img, T) + assert(np.min(img2.get_data()) >= 0) + From 3d7ae10572d2b043842558e1dd1494e8439c07b8 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Thu, 11 Oct 2012 12:18:11 +0200 Subject: [PATCH 004/164] testing the fix --- nipy/algorithms/registration/tests/test_resample.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipy/algorithms/registration/tests/test_resample.py b/nipy/algorithms/registration/tests/test_resample.py index 5ba83ef526..29f1fb10af 100644 --- a/nipy/algorithms/registration/tests/test_resample.py +++ b/nipy/algorithms/registration/tests/test_resample.py @@ -34,9 +34,10 @@ def test_resample_int_data(): _test_resample(arr, (3,)) def test_resample_uint_data(): - arr = np.random.randint(100, size=(10, 11, 12)).astype('uint') + arr = np.random.randint(100, size=(10, 11, 12)).astype('uint8') img = Image(arr, vox2mni(np.eye(4))) T = Affine((.5, .5, .5, .1, .1, .1, 0, 0, 0, 0, 0, 0)) img2 = resample(img, T) assert(np.min(img2.get_data()) >= 0) + assert(np.max(img2.get_data()) < 255) From 7f789403612aae4c68be1e77c0b3448d84d281b9 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sun, 14 Oct 2012 23:05:50 +0200 Subject: [PATCH 005/164] BF: fixed the example to make it work in all circumstances --- .../labs/need_data/example_roi_and_glm.py | 72 ++++++++++--------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index 31994bd5ad..4c6fd0af5c 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -4,7 +4,7 @@ """ This is an example where: -1. An sequence of fMRI volumes are loaded +1. A sequence of fMRI volumes are loaded 2. An ROI mask is loaded 3. A design matrix describing all the effects related to the data is computed 4. A GLM is applied to all voxels in the ROI @@ -79,49 +79,50 @@ hrf_model=hrf_model, add_regs=motion, add_reg_names=add_reg_names) +######################################## +# Create ROIs +######################################## +positions = np.array([[60, -30, 5], [50, 27, 5]]) +# in mm (here in the MNI space) +radii = np.array([8, 6]) + +domain = grid_domain_from_image(mask) +my_roi = mroi.subdomain_from_balls(domain, positions, radii) + +# to save an image of the ROIs +save(my_roi.to_image(), path.join(write_dir, "roi.nii")) ####################################### # Get the FMRI data ####################################### +fmri_data = surrogate_4d_dataset(mask=mask, dmtx=X)[0] +Y = fmri_data.get_data()[mask_array] -fmri_data = surrogate_4d_dataset(mask=mask, dmtx=X, seed=1)[0] +# artificially added signal in ROIs to make the example more meaningful +activation = 30 * (X.T[1] + .5 * X.T[0]) +for (position, radius) in zip(positions, radii): + Y[((domain.coord - position) ** 2).sum(1) < radius ** 2 + 1] += activation ######################################## # Perform a GLM analysis ######################################## # GLM fit -Y = fmri_data.get_data()[mask_array] glm = GeneralLinearModel(X) glm.fit(Y.T) # specifiy the contrast [1 -1 0 ..] -contrast = np.zeros(X.shape[1]) -contrast[:2] = np.array([1, -1]) +contrast = np.hstack(( 1, -1, np.zeros(X.shape[1] - 2))) # compute the constrast image related to it zvals = glm.contrast(contrast).z_score() -zmap = mask_array.astype(np.float) -zmap[mask_array] = zvals ######################################## -# Create ROIs +# ROI-based analysis ######################################## -positions = np.array([[60, -30, 5], [50, 27, 5]]) -# in mm (here in the MNI space) -radii = np.array([8, 6]) - -domain = grid_domain_from_image(mask) -my_roi = mroi.subdomain_from_balls(domain, positions, radii) - -# to save an image of the ROIs -save(my_roi.to_image(), path.join(write_dir, "roi.nii")) - # exact the time courses with ROIs -thresholded_fmri = fmri_data.get_data()[mask_array] -signal_feature = [thresholded_fmri[my_roi.select_id(id, roi=False)] - for id in my_roi.get_id()] +signal_feature = [Y[my_roi.select_id(id, roi=False)] for id in my_roi.get_id()] my_roi.set_feature('signal', signal_feature) # ROI average time courses @@ -139,18 +140,18 @@ # GLM analysis on the ROI average time courses ######################################## -nreg = len(names) -ROI_tc = my_roi.get_roi_feature('signal_avg') -glm.fit(ROI_tc.T) +n_reg = len(names) +roi_tc = my_roi.get_roi_feature('signal_avg') +glm.fit(roi_tc.T) plt.figure() plt.subplot(1, 2, 1) -betas = np.hstack([x.theta for x in glm.results_.values()]) -b1 = plt.bar(np.arange(nreg - 1), betas[:-1, 0], width=.4, color='blue', +betas = glm.get_beta() +b1 = plt.bar(np.arange(n_reg - 1), betas[:-1, 0], width=.4, color='blue', label='region 1') -b2 = plt.bar(np.arange(nreg - 1) + 0.3, betas[:- 1, 1], width=.4, +b2 = plt.bar(np.arange(n_reg - 1) + 0.3, betas[:- 1, 1], width=.4, color='red', label='region 2') -plt.xticks(np.arange(nreg - 1), names[:-1], fontsize=10) +plt.xticks(np.arange(n_reg - 1), names[:-1], fontsize=10) plt.legend() plt.title('Parameter estimates \n for the roi time courses') @@ -163,7 +164,7 @@ res = np.hstack([x.resid for x in glm.results_.values()]).T betas = np.hstack([x.theta for x in glm.results_.values()]) -proj = np.eye(nreg) +proj = np.eye(n_reg) proj[2:] = 0 fit = np.dot(np.dot(betas.T, proj), X.T) @@ -181,16 +182,16 @@ ############################################ fir_order = 6 -X_fir, name_dir = dmtx_light( - frametimes, paradigm, hrf_model='fir', drift_model='cosine', drift_order=3, - fir_delays=tr * np.arange(fir_order), add_regs=motion, +X_fir, _ = dmtx_light( + frametimes, paradigm, hrf_model='fir', drift_model='cosine', + drift_order=3, fir_delays=np.arange(fir_order), add_regs=motion, add_reg_names=add_reg_names) glm_fir = GeneralLinearModel(X_fir) -glm_fir.fit(ROI_tc.T) - plt.figure() + for k in range(my_roi.k): - res = glm_fir.results_.values()[k] + glm_fir.fit(roi_tc[k]) + res = glm_fir.results_.values()[0] plt.subplot(my_roi.k, 1, k + 1) conf_int = res.conf_int(cols=range(fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 @@ -201,4 +202,5 @@ plt.legend(('condition c0', 'condition c1')) plt.title('estimated hrf shape') plt.xlabel('time(scans)') + plt.show() From 2406ec3d8d74c94aeabbc9d38dc3e2f898e4b867 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sun, 14 Oct 2012 23:07:16 +0200 Subject: [PATCH 006/164] ENH: rewrote the line of code for confidence intervals to make the code simpler --- nipy/algorithms/statistics/models/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/statistics/models/model.py b/nipy/algorithms/statistics/models/model.py index e70a443021..837e2910fa 100644 --- a/nipy/algorithms/statistics/models/model.py +++ b/nipy/algorithms/statistics/models/model.py @@ -367,10 +367,10 @@ def conf_int(self, alpha=.05, cols=None, dispersion=None): for i in cols: lower.append( self.theta[i] - inv_t_cdf(1 - alpha / 2, self.df_resid) * - np.sqrt(np.diag(self.vcov(dispersion=dispersion)))[i]) + np.sqrt(self.vcov(column=i, dispersion=dispersion))) upper.append( self.theta[i] + inv_t_cdf(1 - alpha / 2, self.df_resid) * - np.sqrt(np.diag(self.vcov(dispersion=dispersion)))[i]) + np.sqrt(self.vcov(column=i, dispersion=dispersion))) return np.asarray(zip(lower, upper)) From 8d9ac1a95eca967e87c37eb0c8c4937e52692263 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sun, 14 Oct 2012 23:23:16 +0200 Subject: [PATCH 007/164] COSMIT: improved the example (figures + removed unnecessay lines) --- examples/labs/need_data/example_roi_and_glm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index 4c6fd0af5c..d60f1abeec 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -82,6 +82,7 @@ ######################################## # Create ROIs ######################################## + positions = np.array([[60, -30, 5], [50, 27, 5]]) # in mm (here in the MNI space) radii = np.array([8, 6]) @@ -112,7 +113,7 @@ glm.fit(Y.T) # specifiy the contrast [1 -1 0 ..] -contrast = np.hstack(( 1, -1, np.zeros(X.shape[1] - 2))) +contrast = np.hstack((1, -1, np.zeros(X.shape[1] - 2))) # compute the constrast image related to it zvals = glm.contrast(contrast).z_score() @@ -129,8 +130,7 @@ my_roi.set_roi_feature('signal_avg', my_roi.representative_feature('signal')) # roi-level contrast average -thresholded_contrast = zvals -contrast_feature = [thresholded_contrast[my_roi.select_id(id, roi=False)] +contrast_feature = [zvals[my_roi.select_id(id, roi=False)] for id in my_roi.get_id()] my_roi.set_feature('contrast', contrast_feature) my_roi.set_roi_feature('contrast_avg', @@ -183,7 +183,7 @@ fir_order = 6 X_fir, _ = dmtx_light( - frametimes, paradigm, hrf_model='fir', drift_model='cosine', + frametimes, paradigm, hrf_model='fir', drift_model='cosine', drift_order=3, fir_delays=np.arange(fir_order), add_regs=motion, add_reg_names=add_reg_names) glm_fir = GeneralLinearModel(X_fir) @@ -192,7 +192,7 @@ for k in range(my_roi.k): glm_fir.fit(roi_tc[k]) res = glm_fir.results_.values()[0] - plt.subplot(my_roi.k, 1, k + 1) + plt.subplot(1, my_roi.k, k + 1) conf_int = res.conf_int(cols=range(fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 plt.errorbar(np.arange(fir_order), conf_int.mean(1), yerr=yerr) From cab5f689babcd5060cc2056d3cd93f5b854a47d2 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sun, 21 Oct 2012 22:19:26 +0200 Subject: [PATCH 008/164] make it possible to input slice_order=None to FmriRealign4d --- nipy/algorithms/registration/groupwise_registration.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index a9acc5617a..2357570e7f 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -666,6 +666,8 @@ def __init__(self, images, affine_class=Rigid): def _generic_init(self, images, affine_class, slice_order, interleaved, tr, tr_slices, start, time_interp, slice_info): + if slice_order == None: + slice_order = SLICE_ORDER if not hasattr(images, '__iter__'): images = [images] self._runs = [] @@ -742,7 +744,7 @@ def resample(self, r=None, align_runs=True): class FmriRealign4d(Realign4d): def __init__(self, images, slice_order, interleaved=None, - tr=None, tr_slices=None, start=0.0, time_interp=True, + tr=1.0, tr_slices=None, start=0.0, time_interp=True, affine_class=Rigid, slice_info=None): """ From 392e5eeecb7be50febde5b4ea679041144f736c4 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sun, 21 Oct 2012 23:20:12 +0200 Subject: [PATCH 009/164] small edit --- nipy/algorithms/registration/groupwise_registration.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index 2357570e7f..36a321b028 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -667,6 +667,7 @@ def _generic_init(self, images, affine_class, slice_order, interleaved, tr, tr_slices, start, time_interp, slice_info): if slice_order == None: + time_interp = False slice_order = SLICE_ORDER if not hasattr(images, '__iter__'): images = [images] From a92aa8ee859fbcba890d133104959c490cb45f8f Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Mon, 29 Oct 2012 09:39:57 +0100 Subject: [PATCH 010/164] add test for slice_order=None in FmriRealign4d object --- nipy/algorithms/registration/tests/test_fmri_realign4d.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nipy/algorithms/registration/tests/test_fmri_realign4d.py b/nipy/algorithms/registration/tests/test_fmri_realign4d.py index 056ef0be06..e69b9269a4 100644 --- a/nipy/algorithms/registration/tests/test_fmri_realign4d.py +++ b/nipy/algorithms/registration/tests/test_fmri_realign4d.py @@ -79,6 +79,11 @@ def test_slice_timing(): assert_array_almost_equal(im4d.get_data(), x) +def test_realign4d_no_time_interp(): + runs = [im, im] + R = FmriRealign4d(runs, slice_order=None, time_interp=False) + + def test_realign4d(): runs = [im, im] R = FmriRealign4d(runs, tr=2., slice_order='ascending', interleaved=False) From 3f0d0a9f1b67330ced7421d2a5bf71c17883f1bb Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Mon, 12 Nov 2012 09:28:00 +0100 Subject: [PATCH 011/164] account for PR review comments --- .../registration/groupwise_registration.py | 2 ++ .../registration/tests/test_fmri_realign4d.py | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index 36a321b028..0f686c5dae 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -669,6 +669,8 @@ def _generic_init(self, images, affine_class, if slice_order == None: time_interp = False slice_order = SLICE_ORDER + warnings.warn('No slice order provided, ' + + 'switching off time interpolation') if not hasattr(images, '__iter__'): images = [images] self._runs = [] diff --git a/nipy/algorithms/registration/tests/test_fmri_realign4d.py b/nipy/algorithms/registration/tests/test_fmri_realign4d.py index e69b9269a4..125ebd3e7f 100644 --- a/nipy/algorithms/registration/tests/test_fmri_realign4d.py +++ b/nipy/algorithms/registration/tests/test_fmri_realign4d.py @@ -86,5 +86,13 @@ def test_realign4d_no_time_interp(): def test_realign4d(): runs = [im, im] - R = FmriRealign4d(runs, tr=2., slice_order='ascending', interleaved=False) - R.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) + R1 = FmriRealign4d(runs, tr=2., slice_order='ascending', interleaved=False) + R1.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) + R2 = FmriRealign4d(runs, tr=2., slice_order=range(im.shape[2]), interleaved=False) + R2.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) + for r in range(2): + for i in range(im.shape[3]): + assert_array_equal(R1._transforms[r][i].as_affine(), + R2._transforms[r][i].as_affine()) + assert_array_equal(R1._mean_transforms[r].as_affine(), + R2._mean_transforms[r].as_affine()) From 07c4b105b61fed0597a72e6a82d0e32c141475fe Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 13 Nov 2012 17:00:16 -0800 Subject: [PATCH 012/164] BF: fix WindowsError on attempted file deletion Windows raised an error, apparently because of undeleted objects with references to temporary files. --- nipy/modalities/fmri/tests/test_glm.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nipy/modalities/fmri/tests/test_glm.py b/nipy/modalities/fmri/tests/test_glm.py index eb76914fed..f9d7f1d373 100644 --- a/nipy/modalities/fmri/tests/test_glm.py +++ b/nipy/modalities/fmri/tests/test_glm.py @@ -51,7 +51,9 @@ def test_high_level_glm_with_paths(): z_image, = multi_session_model.contrast([np.eye(rk)[1]] * 2) assert_array_equal(z_image.get_affine(), load(mask_file).get_affine()) assert_true(z_image.get_data().std() < 3.) - del z_image, fmri_files + # Delete objects attached to files to avoid WindowsError when deleting + # temporary directory + del z_image, fmri_files, multi_session_model def test_high_level_glm_with_data(): From 78f43b3a1f5f979e0429d99cb72f60ea28e7c914 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Wed, 14 Nov 2012 08:28:13 +0100 Subject: [PATCH 013/164] account for additional PR feedback --- .../registration/groupwise_registration.py | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index 0f686c5dae..81ba443941 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -667,10 +667,13 @@ def _generic_init(self, images, affine_class, slice_order, interleaved, tr, tr_slices, start, time_interp, slice_info): if slice_order == None: - time_interp = False slice_order = SLICE_ORDER - warnings.warn('No slice order provided, ' - + 'switching off time interpolation') + if time_interp: + raise ValueError('Slice order is requested' + + ' with time interpolation switched on') + time_interp = False + if tr == None: + raise ValueError('Repetition time cannot be None') if not hasattr(images, '__iter__'): images = [images] self._runs = [] @@ -757,18 +760,22 @@ def __init__(self, images, slice_order, interleaved=None, ---------- images : image or list of images Single or multiple input 4d images representing one or - several fMRI runs + several fMRI runs. tr : float Inter-scan repetition time, i.e. the time elapsed between - two consecutive scans + two consecutive scans. The unit in which `tr` is given is + arbitrary although it needs to be consistent with the + `tr_slices` and `start` arguments. tr_slices : float - Inter-slice repetition time, same as tr for slices + Inter-slice repetition time, same as tr for slices. If None, + acquisition is assumed continuous and `tr_slices` is set to + `tr` divided by the number of slices. start : float Starting acquisition time respective to the implicit time - origin + origin. slice_order : str or array-like If str, one of {'ascending', 'descending'}. If array-like, From 9abaea8aa65a10b76ae9ee69152a37d2a0004976 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 14 Nov 2012 09:35:08 +0100 Subject: [PATCH 014/164] cosmit: added some comments in the roi_and_glm script to help the motivated readers --- examples/labs/need_data/example_roi_and_glm.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index d60f1abeec..45eb1ff561 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -190,12 +190,18 @@ plt.figure() for k in range(my_roi.k): + # fit a glm on the ROI's time course glm_fir.fit(roi_tc[k]) + # access to the corresponding result structure res = glm_fir.results_.values()[0] plt.subplot(1, my_roi.k, k + 1) + + # get the confidence intervals for the effects and plot them -condition 0 conf_int = res.conf_int(cols=range(fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 plt.errorbar(np.arange(fir_order), conf_int.mean(1), yerr=yerr) + + # get the confidence intervals for the effects and plot them -condition 1 conf_int = res.conf_int(cols=range(fir_order, 2 * fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 plt.errorbar(np.arange(fir_order), conf_int.mean(1), yerr=yerr) From cff760a692a6cfed2753acbb115eab7524405f83 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 14 Nov 2012 16:20:24 -0800 Subject: [PATCH 015/164] BF: move scripts to use nibabel not imageformats Scripts were using outdated imageformats import, now failing. --- scripts/nipy_3dto4d | 10 +++++----- scripts/nipy_4dto3d | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/nipy_3dto4d b/scripts/nipy_3dto4d index b46a2b05e2..f95fd25a88 100755 --- a/scripts/nipy_3dto4d +++ b/scripts/nipy_3dto4d @@ -8,15 +8,15 @@ import os from os.path import join as pjoin import nipy.externals.argparse as argparse -import nipy.io.imageformats as nii +import nibabel as nib def do_3d_to_4d(filenames, check_affines=True): imgs = [] for fname in filenames: - img = nii.load(fname) + img = nib.load(fname) imgs.append(img) - return nii.concat_images(imgs, check_affines=check_affines) + return nib.concat_images(imgs, check_affines=check_affines) def main(): @@ -52,8 +52,8 @@ def main(): gz = '' out_fname = pjoin(pth, froot + '_4d' + ext + gz) img4d = do_3d_to_4d(filenames, check_affines=check_affines) - nii.save(img4d, out_fname) - + nib.save(img4d, out_fname) + if __name__ == '__main__': main() diff --git a/scripts/nipy_4dto3d b/scripts/nipy_4dto3d index a5ce24da89..962f303498 100755 --- a/scripts/nipy_4dto3d +++ b/scripts/nipy_4dto3d @@ -7,7 +7,7 @@ analyze, MINC, at the moment, as nifti 3D files ''' import os import nipy.externals.argparse as argparse -import nipy.io.imageformats as nii +import nibael as nib def main(): @@ -18,14 +18,14 @@ def main(): help='4D image filename') # parse the command line args = parser.parse_args() - img = nii.load(args.filename) - imgs = nii.four_to_three(img) + img = nib.load(args.filename) + imgs = nib.four_to_three(img) froot, ext = os.path.splitext(args.filename) if ext in ('.gz', '.bz2'): froot, ext = os.path.splitext(froot) for i, img3d in enumerate(imgs): fname3d = '%s_%04d.nii' % (froot, i) - nii.save(img3d, fname3d) + nib.save(img3d, fname3d) if __name__ == '__main__': From b7947cdc67cfdc1b39631c40b77ac64f23c38621 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Thu, 15 Nov 2012 21:56:44 +0100 Subject: [PATCH 016/164] make realign4d test more robust in hope to correct test failures --- .../registration/tests/test_fmri_realign4d.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/nipy/algorithms/registration/tests/test_fmri_realign4d.py b/nipy/algorithms/registration/tests/test_fmri_realign4d.py index 125ebd3e7f..2a67f4fc24 100644 --- a/nipy/algorithms/registration/tests/test_fmri_realign4d.py +++ b/nipy/algorithms/registration/tests/test_fmri_realign4d.py @@ -8,6 +8,7 @@ from .... import load_image from ....testing import funcfile +from ....fixes.nibabel import io_orientation from ..groupwise_registration import Image4d, resample4d, FmriRealign4d from ..affine import Rigid @@ -86,13 +87,15 @@ def test_realign4d_no_time_interp(): def test_realign4d(): runs = [im, im] - R1 = FmriRealign4d(runs, tr=2., slice_order='ascending', interleaved=False) + orient = io_orientation(im.affine) + slice_axis = int(np.where(orient[:, 0] == 2)[0]) + R1 = FmriRealign4d(runs, tr=2., slice_order='ascending') R1.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) - R2 = FmriRealign4d(runs, tr=2., slice_order=range(im.shape[2]), interleaved=False) + R2 = FmriRealign4d(runs, tr=2., slice_order=range(im.shape[slice_axis])) R2.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) for r in range(2): for i in range(im.shape[3]): - assert_array_equal(R1._transforms[r][i].as_affine(), - R2._transforms[r][i].as_affine()) - assert_array_equal(R1._mean_transforms[r].as_affine(), - R2._mean_transforms[r].as_affine()) + assert_array_almost_equal(R1._transforms[r][i].as_affine(), + R2._transforms[r][i].as_affine()) + assert_array_almost_equal(R1._mean_transforms[r].as_affine(), + R2._mean_transforms[r].as_affine()) From d47c511e6d86369216ed383da44d8ccc476609f5 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sat, 13 Oct 2012 02:16:22 +0200 Subject: [PATCH 017/164] implement fast quantile independently from libcstat --- nipy/algorithms/statistics/__init__.py | 1 + nipy/algorithms/statistics/_quantile.c | 5032 ++++++++++++++++++++++ nipy/algorithms/statistics/_quantile.pyx | 65 + nipy/algorithms/statistics/quantile.c | 262 ++ nipy/algorithms/statistics/quantile.h | 19 + nipy/algorithms/statistics/setup.py | 5 +- 6 files changed, 5383 insertions(+), 1 deletion(-) create mode 100644 nipy/algorithms/statistics/_quantile.c create mode 100644 nipy/algorithms/statistics/_quantile.pyx create mode 100644 nipy/algorithms/statistics/quantile.c create mode 100644 nipy/algorithms/statistics/quantile.h diff --git a/nipy/algorithms/statistics/__init__.py b/nipy/algorithms/statistics/__init__.py index a68cd93ad1..698a1a5e52 100644 --- a/nipy/algorithms/statistics/__init__.py +++ b/nipy/algorithms/statistics/__init__.py @@ -6,6 +6,7 @@ __docformat__ = 'restructuredtext' from . import intvol, rft, onesample, formula +from ._quantile import _quantile as quantile, _median as median from nipy.testing import Tester test = Tester().test diff --git a/nipy/algorithms/statistics/_quantile.c b/nipy/algorithms/statistics/_quantile.c new file mode 100644 index 0000000000..973add1415 --- /dev/null +++ b/nipy/algorithms/statistics/_quantile.c @@ -0,0 +1,5032 @@ +/* Generated by Cython 0.15.1 on Sat Oct 13 02:13:56 2012 */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif + +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif + +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif + +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif + +#if PY_VERSION_HEX < 0x02040000 + #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#endif + +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) PyNumber_Int(o) + #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + +#endif + +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" +#endif + +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif + +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif + +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif + +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) + +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif + +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif + +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE__nipy__algorithms__statistics___quantile +#define __PYX_HAVE_API__nipy__algorithms__statistics___quantile +#include "quantile.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif + +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || defined(__INTEL_COMPILER) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) + +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); + +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +static const char *__pyx_f[] = { + "_quantile.pyx", + "numpy.pxd", +}; + +/* "numpy.pxd":719 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":720 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":721 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":722 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":726 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":727 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":728 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":729 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":733 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":734 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":743 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":744 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":745 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":747 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":748 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":749 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":751 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":754 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":755 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":756 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/*--- Type declarations ---*/ + +/* "numpy.pxd":758 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":760 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":762 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; + #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + Py_INCREF(v); + Py_DECREF(PyList_GET_ITEM(o, i)); + PyList_SET_ITEM(o, i, v); + return 1; + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) + return PySequence_SetItem(o, i, v); + else { + PyObject *j = PyInt_FromSsize_t(i); + return __Pyx_SetItemInt_Generic(o, j, v); + } +} + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); + } + return r; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ + +/* Module declarations from 'nipy.algorithms.statistics._quantile' */ +#define __Pyx_MODULE_NAME "nipy.algorithms.statistics._quantile" +int __pyx_module_is_main_nipy__algorithms__statistics___quantile = 0; + +/* Implementation of 'nipy.algorithms.statistics._quantile' */ +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "ndarray is not C contiguous"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nVery fast quantile computation using partial sorting.\nAuthor: Alexis Roche.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_15[] = "nipy.algorithms.statistics._quantile"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__X[] = "X"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__axis[] = "axis"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__ratio[] = "ratio"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__interp[] = "interp"; +static char __pyx_k___median[] = "_median"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k___quantile[] = "_quantile"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____version__[] = "__version__"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static PyObject *__pyx_kp_u_1; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_n_s_15; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s____version__; +static PyObject *__pyx_n_s___median; +static PyObject *__pyx_n_s___quantile; +static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__interp; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__ratio; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; + +/* "nipy/algorithms/statistics/_quantile.pyx":24 + * # This is faster than scipy.stats.scoreatpercentile due to partial + * # sorting + * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< + * """ + * q = quantile(data, ratio, interp=False, axis=0). + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile[] = "\n q = quantile(data, ratio, interp=False, axis=0).\n\n Partial sorting algorithm, very fast!!!\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile = {__Pyx_NAMESTR("_quantile"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile)}; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_X = 0; + double __pyx_v_ratio; + int __pyx_v_interp; + int __pyx_v_axis; + double *__pyx_v_x; + double *__pyx_v_y; + long __pyx_v_size; + long __pyx_v_stride; + PyArrayIterObject *__pyx_v_itX = 0; + PyArrayIterObject *__pyx_v_itY = 0; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + long __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__ratio,&__pyx_n_s__interp,&__pyx_n_s__axis,0}; + __Pyx_RefNannySetupContext("_quantile"); + __pyx_self = __pyx_self; + { + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ratio); + if (likely(values[1])) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("_quantile", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[3] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = values[0]; + __pyx_v_ratio = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_ratio == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (values[2]) { + __pyx_v_interp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_interp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_interp = ((int)0); + } + if (values[3]) { + __pyx_v_axis = __Pyx_PyInt_AsInt(values[3]); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_axis = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_quantile", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "nipy/algorithms/statistics/_quantile.pyx":35 + * + * # Allocate output array Y + * dims = list(X.shape) # <<<<<<<<<<<<<< + * dims[axis] = 1 + * Y = np.zeros(dims) + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":36 + * # Allocate output array Y + * dims = list(X.shape) + * dims[axis] = 1 # <<<<<<<<<<<<<< + * Y = np.zeros(dims) + * + */ + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/_quantile.pyx":37 + * dims = list(X.shape) + * dims[axis] = 1 + * Y = np.zeros(dims) # <<<<<<<<<<<<<< + * + * # Set size and stride along specified axis + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_Y = __pyx_t_3; + __pyx_t_3 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":40 + * + * # Set size and stride along specified axis + * size = X.shape[axis] # <<<<<<<<<<<<<< + * stride = X.strides[axis] / sizeof(double) + * + */ + __pyx_t_3 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_size = __pyx_t_4; + + /* "nipy/algorithms/statistics/_quantile.pyx":41 + * # Set size and stride along specified axis + * size = X.shape[axis] + * stride = X.strides[axis] / sizeof(double) # <<<<<<<<<<<<<< + * + * # Create array iterators + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__strides); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_stride = __pyx_t_4; + + /* "nipy/algorithms/statistics/_quantile.pyx":44 + * + * # Create array iterators + * itX = np.PyArray_IterAllButAxis(X, &axis) # <<<<<<<<<<<<<< + * itY = np.PyArray_IterAllButAxis(Y, &axis) + * + */ + __pyx_t_2 = PyArray_IterAllButAxis(__pyx_v_X, (&__pyx_v_axis)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itX = ((PyArrayIterObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":45 + * # Create array iterators + * itX = np.PyArray_IterAllButAxis(X, &axis) + * itY = np.PyArray_IterAllButAxis(Y, &axis) # <<<<<<<<<<<<<< + * + * # Loop + */ + __pyx_t_2 = PyArray_IterAllButAxis(__pyx_v_Y, (&__pyx_v_axis)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itY = ((PyArrayIterObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":48 + * + * # Loop + * while np.PyArray_ITER_NOTDONE(itX): # <<<<<<<<<<<<<< + * x = np.PyArray_ITER_DATA(itX) + * y = np.PyArray_ITER_DATA(itY) + */ + while (1) { + __pyx_t_5 = PyArray_ITER_NOTDONE(__pyx_v_itX); + if (!__pyx_t_5) break; + + /* "nipy/algorithms/statistics/_quantile.pyx":49 + * # Loop + * while np.PyArray_ITER_NOTDONE(itX): + * x = np.PyArray_ITER_DATA(itX) # <<<<<<<<<<<<<< + * y = np.PyArray_ITER_DATA(itY) + * y[0] = quantile(x, size, stride, ratio, interp) + */ + __pyx_v_x = ((double *)PyArray_ITER_DATA(__pyx_v_itX)); + + /* "nipy/algorithms/statistics/_quantile.pyx":50 + * while np.PyArray_ITER_NOTDONE(itX): + * x = np.PyArray_ITER_DATA(itX) + * y = np.PyArray_ITER_DATA(itY) # <<<<<<<<<<<<<< + * y[0] = quantile(x, size, stride, ratio, interp) + * np.PyArray_ITER_NEXT(itX) + */ + __pyx_v_y = ((double *)PyArray_ITER_DATA(__pyx_v_itY)); + + /* "nipy/algorithms/statistics/_quantile.pyx":51 + * x = np.PyArray_ITER_DATA(itX) + * y = np.PyArray_ITER_DATA(itY) + * y[0] = quantile(x, size, stride, ratio, interp) # <<<<<<<<<<<<<< + * np.PyArray_ITER_NEXT(itX) + * np.PyArray_ITER_NEXT(itY) + */ + (__pyx_v_y[0]) = quantile(__pyx_v_x, __pyx_v_size, __pyx_v_stride, __pyx_v_ratio, __pyx_v_interp); + + /* "nipy/algorithms/statistics/_quantile.pyx":52 + * y = np.PyArray_ITER_DATA(itY) + * y[0] = quantile(x, size, stride, ratio, interp) + * np.PyArray_ITER_NEXT(itX) # <<<<<<<<<<<<<< + * np.PyArray_ITER_NEXT(itY) + * + */ + PyArray_ITER_NEXT(__pyx_v_itX); + + /* "nipy/algorithms/statistics/_quantile.pyx":53 + * y[0] = quantile(x, size, stride, ratio, interp) + * np.PyArray_ITER_NEXT(itX) + * np.PyArray_ITER_NEXT(itY) # <<<<<<<<<<<<<< + * + * return Y + */ + PyArray_ITER_NEXT(__pyx_v_itY); + } + + /* "nipy/algorithms/statistics/_quantile.pyx":55 + * np.PyArray_ITER_NEXT(itY) + * + * return Y # <<<<<<<<<<<<<< + * + * # This is faster than numpy.stats + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_Y); + __pyx_r = __pyx_v_Y; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_itX); + __Pyx_XDECREF((PyObject *)__pyx_v_itY); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_Y); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/_quantile.pyx":60 + * # due to the underlying algorithm that relies on + * # partial sorting as opposed to full sorting. + * def _median(X, axis=0): # <<<<<<<<<<<<<< + * """ + * median(X, axis=0) + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median[] = "\n median(X, axis=0)\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median = {__Pyx_NAMESTR("_median"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median)}; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_X = 0; + PyObject *__pyx_v_axis = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__axis,0}; + __Pyx_RefNannySetupContext("_median"); + __pyx_self = __pyx_self; + { + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)__pyx_int_0); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 0: + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); + if (likely(values[0])) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = values[0]; + __pyx_v_axis = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("_median", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._median", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + + /* "nipy/algorithms/statistics/_quantile.pyx":64 + * median(X, axis=0) + * """ + * return _quantile(X, axis=axis, ratio=0.5, interp=True) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___quantile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(__pyx_v_X); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_X); + __Pyx_GIVEREF(__pyx_v_X); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_v_axis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ratio), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__interp), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._median", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":190 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__"); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":196 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":199 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":200 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":202 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":204 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":205 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L6; + } + /*else*/ { + + /* "numpy.pxd":207 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L6:; + + /* "numpy.pxd":209 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":210 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":213 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":218 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":219 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":222 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":223 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":224 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":225 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + + /* "numpy.pxd":226 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + } + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":228 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":229 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + } + __pyx_L9:; + + /* "numpy.pxd":230 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":231 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + + /* "numpy.pxd":232 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + + /* "numpy.pxd":235 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":236 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + + /* "numpy.pxd":240 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":242 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":244 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L12; + } + /*else*/ { + + /* "numpy.pxd":247 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = __pyx_v_self; + } + __pyx_L12:; + + /* "numpy.pxd":249 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":250 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + */ + __pyx_v_t = __pyx_v_descr->type_num; + + /* "numpy.pxd":251 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":252 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L14; + } + __pyx_L14:; + + /* "numpy.pxd":254 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L15; + } + + /* "numpy.pxd":255 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L15; + } + + /* "numpy.pxd":256 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L15; + } + + /* "numpy.pxd":257 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L15; + } + + /* "numpy.pxd":258 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L15; + } + + /* "numpy.pxd":259 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L15; + } + + /* "numpy.pxd":260 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L15; + } + + /* "numpy.pxd":261 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L15; + } + + /* "numpy.pxd":262 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L15; + } + + /* "numpy.pxd":263 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L15; + } + + /* "numpy.pxd":264 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L15; + } + + /* "numpy.pxd":265 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L15; + } + + /* "numpy.pxd":266 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L15; + } + + /* "numpy.pxd":267 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L15; + } + + /* "numpy.pxd":268 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L15; + } + + /* "numpy.pxd":269 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L15; + } + + /* "numpy.pxd":270 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L15; + } + /*else*/ { + + /* "numpy.pxd":272 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L15:; + + /* "numpy.pxd":273 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":274 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":276 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":277 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":278 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":281 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":282 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = 0; + } + __pyx_L13:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":284 + * f[0] = 0 # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + + /* "numpy.pxd":285 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { + + /* "numpy.pxd":286 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":287 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":288 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":764 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "numpy.pxd":765 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":767 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":770 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "numpy.pxd":771 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":773 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "numpy.pxd":774 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":776 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "numpy.pxd":777 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":779 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + long __pyx_t_10; + char *__pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring"); + + /* "numpy.pxd":786 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":787 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":790 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":791 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":792 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { + if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); + else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":794 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":797 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "numpy.pxd":798 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; + } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":809 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; + + /* "numpy.pxd":810 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":811 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":812 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + } + + /* "numpy.pxd":814 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_10 = 0; + (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + + /* "numpy.pxd":816 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { + + /* "numpy.pxd":817 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":818 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; + + /* "numpy.pxd":822 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } + + /* "numpy.pxd":823 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } + + /* "numpy.pxd":824 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } + + /* "numpy.pxd":825 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } + + /* "numpy.pxd":826 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } + + /* "numpy.pxd":827 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } + + /* "numpy.pxd":828 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } + + /* "numpy.pxd":829 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } + + /* "numpy.pxd":830 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } + + /* "numpy.pxd":831 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } + + /* "numpy.pxd":832 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } + + /* "numpy.pxd":833 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } + + /* "numpy.pxd":834 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } + + /* "numpy.pxd":835 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":837 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + + /* "numpy.pxd":838 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":840 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + + /* "numpy.pxd":841 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L9; + } + /*else*/ { + + /* "numpy.pxd":845 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_11; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":846 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":961 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + + /* "numpy.pxd":963 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":964 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":966 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":967 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":968 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":969 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + + /* "numpy.pxd":972 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":973 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":975 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + __Pyx_NAMESTR("_quantile"), + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, + {&__pyx_n_s___median, __pyx_k___median, sizeof(__pyx_k___median), 0, 0, 1, 1}, + {&__pyx_n_s___quantile, __pyx_k___quantile, sizeof(__pyx_k___quantile), 0, 0, 1, 1}, + {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__ratio, __pyx_k__ratio, sizeof(__pyx_k__ratio), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + + /* "numpy.pxd":211 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":253 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":795 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":799 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":819 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_quantile(void); /*proto*/ +PyMODINIT_FUNC init_quantile(void) +#else +PyMODINIT_FUNC PyInit__quantile(void); /*proto*/ +PyMODINIT_FUNC PyInit__quantile(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__quantile(void)"); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __pyx_binding_PyCFunctionType_USED + if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_quantile"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + #if PY_MAJOR_VERSION < 3 + Py_INCREF(__pyx_m); + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); + if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_nipy__algorithms__statistics___quantile) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + /*--- Type import code ---*/ + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "nipy/algorithms/statistics/_quantile.pyx":8 + * """ + * + * __version__ = '0.1' # <<<<<<<<<<<<<< + * + * cdef extern from "quantile.h": + */ + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/_quantile.pyx":17 + * int interp) + * + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":20 + * cimport numpy as np + * + * np.import_array() # <<<<<<<<<<<<<< + * + * # This is faster than scipy.stats.scoreatpercentile due to partial + */ + import_array(); + + /* "nipy/algorithms/statistics/_quantile.pyx":24 + * # This is faster than scipy.stats.scoreatpercentile due to partial + * # sorting + * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< + * """ + * q = quantile(data, ratio, interp=False, axis=0). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile, NULL, __pyx_n_s_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___quantile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":60 + * # due to the underlying algorithm that relies on + * # partial sorting as opposed to full sorting. + * def _median(X, axis=0): # <<<<<<<<<<<<<< + * """ + * median(X, axis=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median, NULL, __pyx_n_s_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___median, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":971 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init nipy.algorithms.statistics._quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init nipy.algorithms.statistics._quantile"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ + +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AS_STRING(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + } else { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; + } else { + for (name = first_kw_arg; *name; name++) { + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) break; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) break; + #endif + } + if (*name) { + values[name-argnames] = value; + } else { + /* unexpected keyword found */ + for (name=argnames; name != first_kw_arg; name++) { + if (**name == key) goto arg_passed_twice; + #if PY_MAJOR_VERSION >= 3 + if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && + PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; + #else + if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && + _PyString_Eq(**name, key)) goto arg_passed_twice; + #endif + } + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + } + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, **name); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + /* cause is unused */ + Py_XINCREF(type); + Py_XINCREF(value); + Py_XINCREF(tb); + /* First, check the traceback argument, replacing None with NULL. */ + if (tb == Py_None) { + Py_DECREF(tb); + tb = 0; + } + else if (tb != NULL && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + /* Next, replace a missing value with None */ + if (value == NULL) { + value = Py_None; + Py_INCREF(value); + } + #if PY_VERSION_HEX < 0x02050000 + if (!PyClass_Check(type)) + #else + if (!PyType_Check(type)) + #endif + { + /* Raising an instance. The value should be a dummy. */ + if (value != Py_None) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + /* Normalize to raise , */ + Py_DECREF(value); + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} + +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + if (cause) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + if (!value) { + value = PyObject_CallObject(type, NULL); + } + PyException_SetCause(value, fixed_cause); + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) + goto bad; + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + Py_XDECREF(empty_list); + Py_XDECREF(py_import); + Py_XDECREF(empty_dict); + return module; +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(class_name); + #else + py_name = PyUnicode_FromString(class_name); + #endif + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } + if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + + #if PY_MAJOR_VERSION < 3 + py_name = PyString_FromString(name); + #else + py_name = PyUnicode_FromString(name); + #endif + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" + +static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, + int __pyx_lineno, const char *__pyx_filename) { + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + PyObject *py_globals = 0; + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(__pyx_filename); + #else + py_srcfile = PyUnicode_FromString(__pyx_filename); + #endif + if (!py_srcfile) goto bad; + if (__pyx_clineno) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_code = PyCode_New( + 0, /*int argcount,*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*int kwonlyargcount,*/ + #endif + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + __pyx_lineno, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + if (!py_code) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = __pyx_lineno; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +/* Type Conversion Functions */ + +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} + +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} + +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} + +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} + +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/nipy/algorithms/statistics/_quantile.pyx b/nipy/algorithms/statistics/_quantile.pyx new file mode 100644 index 0000000000..fe2c01b1db --- /dev/null +++ b/nipy/algorithms/statistics/_quantile.pyx @@ -0,0 +1,65 @@ +# -*- Mode: Python -*- Not really, but the syntax is close enough + +""" +Very fast quantile computation using partial sorting. +Author: Alexis Roche. +""" + +__version__ = '0.1' + +cdef extern from "quantile.h": + double quantile(double* data, + unsigned long size, + unsigned long stride, + double r, + int interp) + +import numpy as np +cimport numpy as np + +np.import_array() + +# This is faster than scipy.stats.scoreatpercentile due to partial +# sorting +def _quantile(X, double ratio, int interp=False, int axis=0): + """ + q = quantile(data, ratio, interp=False, axis=0). + + Partial sorting algorithm, very fast!!! + """ + cdef double *x, *y + cdef long int size, stride + cdef np.flatiter itX, itY + + # Allocate output array Y + dims = list(X.shape) + dims[axis] = 1 + Y = np.zeros(dims) + + # Set size and stride along specified axis + size = X.shape[axis] + stride = X.strides[axis] / sizeof(double) + + # Create array iterators + itX = np.PyArray_IterAllButAxis(X, &axis) + itY = np.PyArray_IterAllButAxis(Y, &axis) + + # Loop + while np.PyArray_ITER_NOTDONE(itX): + x = np.PyArray_ITER_DATA(itX) + y = np.PyArray_ITER_DATA(itY) + y[0] = quantile(x, size, stride, ratio, interp) + np.PyArray_ITER_NEXT(itX) + np.PyArray_ITER_NEXT(itY) + + return Y + +# This is faster than numpy.stats +# due to the underlying algorithm that relies on +# partial sorting as opposed to full sorting. +def _median(X, axis=0): + """ + median(X, axis=0) + """ + return _quantile(X, axis=axis, ratio=0.5, interp=True) + diff --git a/nipy/algorithms/statistics/quantile.c b/nipy/algorithms/statistics/quantile.c new file mode 100644 index 0000000000..46607e0bed --- /dev/null +++ b/nipy/algorithms/statistics/quantile.c @@ -0,0 +1,262 @@ +#include "quantile.h" + +#include +#include + +#ifdef INFINITY +#define POSINF INFINITY +#else +#define POSINF HUGE_VAL +#endif + +#define UNSIGNED_FLOOR(a) ( (int)(a) ) +#define UNSIGNED_CEIL(a) ( ( (int)(a)-a )!=0.0 ? (int)(a+1) : (int)(a) ) +#define SWAP(a, b) {tmp=(a); (a)=(b); (b)=tmp;} + + +/* Declaration of static functions */ +static double _pth_element(double* x, + unsigned long p, + unsigned long stride, + unsigned long size); +static void _pth_interval(double* am, + double* aM, + double* x, + unsigned long p, + unsigned long stride, + unsigned long size); + +/* + Quantile. + + Given a sample x, this function computes a value q so that the + number of sample values that are greater or equal to q is smaller + or equal to (1-r) * sample size. +*/ +double quantile(double* data, + unsigned long size, + unsigned long stride, + double r, + int interp) +{ + double m, pp; + unsigned long p; + + if ((r<0) || (r>1)){ + fprintf(stderr, "Ratio must be in [0,1], returning zero"); + return 0.0; + } + + if (size == 1) + return data[0]; + + /* Find the smallest index p so that p >= r * size */ + if (!interp) { + pp = r * size; + p = UNSIGNED_CEIL(pp); + if (p == size) + return POSINF; + m = _pth_element(data, p, stride, size); + } + else { + double wm, wM; + pp = r * (size-1); + p = UNSIGNED_FLOOR(pp); + wM = pp - (double)p; + wm = 1.0 - wM; + if (wM <= 0) + m = _pth_element(data, p, stride, size); + else { + double am, aM; + _pth_interval(&am, &aM, data, p, stride, size); + m = wm*am + wM*aM; + } + } + + return m; +} + + +/*** STATIC FUNCTIONS ***/ +/* BEWARE: the input array x gets modified! */ + +/* + Pick up the sample value a so that: + (p+1) sample values are <= a AND the remaining sample values are >= a + +*/ + + +static double _pth_element(double* x, + unsigned long p, + unsigned long stride, + unsigned long n) +{ + double a, tmp; + double *bufl, *bufr; + unsigned long i, j, il, jr, stop1, stop2; + int same_extremities; + + stop1 = 0; + il = 0; + jr = n-1; + while (stop1 == 0) { + + same_extremities = 0; + bufl = x + stride*il; + bufr = x + stride*jr; + if (*bufl > *bufr) + SWAP(*bufl, *bufr) + else if (*bufl == *bufr) + same_extremities = 1; + a = *bufl; + + if (il == jr) + return a; + bufl += stride; + i = il + 1; + j = jr; + + stop2 = 0; + while (stop2 == 0) { + while (*bufl < a) { + i ++; + bufl += stride; + } + while (*bufr > a) { + j --; + bufr -= stride; + } + if (j <= i) + stop2 = 1; + else { + SWAP(*bufl, *bufr) + j --; bufr -= stride; + i ++; bufl += stride; + } + + /* Avoids infinite loops in samples with redundant values. + This situation can only occur with i == j */ + if ((same_extremities) && (j==jr)) { + j --; + bufr -= stride; + SWAP(x[il*stride], *bufr) + stop2 = 1; + } + } + + /* At this point, we know that il <= j <= i; moreover: + if k <= j, x(j) <= a and if k > j, x(j) >= a + if k < i, x(i) <= a and if k >= i, x(i) >= a + + We hence have: (j+1) values <= a and the remaining (n-j-1) >= a + i values <= a and the remaining (n-i) >= a + */ + + if (j > p) + jr = j; + else if (j < p) + il = i; + else /* j == p */ + stop1 = 1; + + } + + return a; +} + + +/* BEWARE: the input array x gets modified! */ +static void _pth_interval(double* am, + double* aM, + double* x, + unsigned long p, + unsigned long stride, + unsigned long n) +{ + double a, tmp; + double *bufl, *bufr; + unsigned long i, j, il, jr, stop1, stop2, stop3; + unsigned long pp = p+1; + int same_extremities = 0; + + *am = 0.0; + *aM = 0.0; + stop1 = 0; + stop2 = 0; + il = 0; + jr = n-1; + while ((stop1 == 0) || (stop2 == 0)) { + + same_extremities = 0; + bufl = x + stride*il; + bufr = x + stride*jr; + if (*bufl > *bufr) + SWAP(*bufl, *bufr) + else if (*bufl == *bufr) + same_extremities = 1; + a = *bufl; + + if (il == jr) { + *am=a; + *aM=a; + return; + } + + bufl += stride; + i = il + 1; + j = jr; + + stop3 = 0; + while (stop3 == 0) { + + while (*bufl < a) { + i ++; + bufl += stride; + } + while (*bufr > a) { + j --; + bufr -= stride; + } + if (j <= i) + stop3 = 1; + else { + SWAP(*bufl, *bufr) + j --; bufr -= stride; + i ++; bufl += stride; + } + + /* Avoids infinite loops in samples with redundant values */ + if ((same_extremities) && (j==jr)) { + j --; + bufr -= stride; + SWAP(x[il*stride], *bufr) + stop3 = 1; + } + + } + + /* At this point, we know that there are (j+1) datapoints <=a + including a itself, and another (n-j-1) datapoints >=a */ + if (j > pp) + jr = j; + else if (j < p) + il = i; + /* Case: found percentile at p */ + else if (j == p) { + il = i; + *am = a; + stop1 = 1; + } + /* Case: found percentile at (p+1), ie j==(p+1) */ + else { + jr = j; + *aM = a; + stop2 = 1; + } + + } + + return; +} + diff --git a/nipy/algorithms/statistics/quantile.h b/nipy/algorithms/statistics/quantile.h new file mode 100644 index 0000000000..7e4717e9d6 --- /dev/null +++ b/nipy/algorithms/statistics/quantile.h @@ -0,0 +1,19 @@ +#ifndef QUANTILE +#define QUANTILE + +#ifdef __cplusplus +extern "C" { +#endif + + extern double quantile(double* data, + unsigned long size, + unsigned long stride, + double r, + int interp); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/nipy/algorithms/statistics/setup.py b/nipy/algorithms/statistics/setup.py index 6baeb9b3a6..93374e5ba5 100644 --- a/nipy/algorithms/statistics/setup.py +++ b/nipy/algorithms/statistics/setup.py @@ -1,7 +1,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import numpy as np - +import os def configuration(parent_package='', top_path=None): from numpy.distutils.misc_util import Configuration @@ -10,10 +10,13 @@ def configuration(parent_package='', top_path=None): config.add_subpackage('formula') config.add_subpackage('bench') config.add_subpackage('tests') + config.add_include_dirs(config.name.replace('.', os.sep)) config.add_extension('intvol', 'intvol.pyx', include_dirs=[np.get_include()]) config.add_extension('histogram', 'histogram.pyx', include_dirs=[np.get_include()]) + config.add_extension('_quantile', + sources=['_quantile.pyx', 'quantile.c']) return config From 47a75131a39108e5a85cc0450b7ebbf7078b7bd8 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sat, 13 Oct 2012 02:21:00 +0200 Subject: [PATCH 018/164] make viz_tools point to the new quantile function --- nipy/labs/viz_tools/edge_detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/labs/viz_tools/edge_detect.py b/nipy/labs/viz_tools/edge_detect.py index e592f5d32e..5530b2c228 100644 --- a/nipy/labs/viz_tools/edge_detect.py +++ b/nipy/labs/viz_tools/edge_detect.py @@ -10,7 +10,7 @@ try: # Protect this import as it is compiled code - from nipy.labs.utils.routines import quantile + from nipy.algorithms.statistics import quantile except ImportError, e: warnings.warn('Could not import fast quantile function: %s' % e) quantile = None From 4ef0582b9c2a615aaf75e69064c7906fee21121b Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sun, 14 Oct 2012 00:30:39 +0200 Subject: [PATCH 019/164] update docstrings + add tests --- nipy/algorithms/statistics/_quantile.pyx | 46 +++++++++++++++++-- .../statistics/tests/test_quantile.py | 25 ++++++++++ 2 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 nipy/algorithms/statistics/tests/test_quantile.py diff --git a/nipy/algorithms/statistics/_quantile.pyx b/nipy/algorithms/statistics/_quantile.pyx index fe2c01b1db..669281db8c 100644 --- a/nipy/algorithms/statistics/_quantile.pyx +++ b/nipy/algorithms/statistics/_quantile.pyx @@ -19,18 +19,43 @@ cimport numpy as np np.import_array() -# This is faster than scipy.stats.scoreatpercentile due to partial +# This is faster than scipy.stats.scoreatpercentile owing to partial # sorting def _quantile(X, double ratio, int interp=False, int axis=0): """ - q = quantile(data, ratio, interp=False, axis=0). + Fast quantile computation using partial sorting. - Partial sorting algorithm, very fast!!! + Parameters + ---------- + X : array + Input array. + + ratio : float + A value in range [0, 1] defining the desired quantiles (the + higher the ratio, the higher the quantiles). + + interp : boolean + Determine whether quantiles are interpolated. + + axis : int + Axis along which quantiles are computed. + + Output + ------ + Y : array + Array of quantiles """ cdef double *x, *y cdef long int size, stride cdef np.flatiter itX, itY + # Convert the input array to double if needed + X = np.asarray(X, dtype='double') + + # Check the input ratio is in range (0,1) + if ratio < 0 or ratio > 1: + raise ValueError('ratio must be in range 0..1') + # Allocate output array Y dims = list(X.shape) dims[axis] = 1 @@ -59,7 +84,20 @@ def _quantile(X, double ratio, int interp=False, int axis=0): # partial sorting as opposed to full sorting. def _median(X, axis=0): """ - median(X, axis=0) + Fast median computation using partial sorting. + + Parameters + ---------- + X : array + Input array. + + axis : int + Axis along which medians are computed. + + Output + ------ + Y : array + Array of medians """ return _quantile(X, axis=axis, ratio=0.5, interp=True) diff --git a/nipy/algorithms/statistics/tests/test_quantile.py b/nipy/algorithms/statistics/tests/test_quantile.py new file mode 100644 index 0000000000..7791e3380a --- /dev/null +++ b/nipy/algorithms/statistics/tests/test_quantile.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + +import numpy as np + +from .._quantile import _quantile, _median +from numpy.testing import assert_array_equal + +def test_median(): + X = np.array([np.arange(11) for i in range(20)]) + assert_array_equal(_median(X, axis=1).squeeze(), + 5 * np.ones(20)) + assert_array_equal(_median(X.T.astype('double')).squeeze(), + 5 * np.ones(20)) + +def test_quantile(): + X = np.array([np.arange(1, 10) for i in range(20)]) + assert_array_equal(_quantile(X, axis=1, ratio=.8).squeeze(), + 9 * np.ones(20)) + assert_array_equal(_quantile(X.T.astype('double'), ratio=.8).squeeze(), + 9 * np.ones(20)) + + +if __name__ == "__main__": + import nose + nose.run(argv=['', __file__]) From f9913f90c70f660476ac32b20c9254b1839d1187 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Wed, 14 Nov 2012 08:46:10 +0100 Subject: [PATCH 020/164] account for PR comments --- nipy/algorithms/statistics/_quantile.pyx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nipy/algorithms/statistics/_quantile.pyx b/nipy/algorithms/statistics/_quantile.pyx index 669281db8c..dd2f077e8a 100644 --- a/nipy/algorithms/statistics/_quantile.pyx +++ b/nipy/algorithms/statistics/_quantile.pyx @@ -23,12 +23,15 @@ np.import_array() # sorting def _quantile(X, double ratio, int interp=False, int axis=0): """ - Fast quantile computation using partial sorting. + Fast quantile computation using partial sorting. This function has + similar behavior to `scipy.percentile` but runs significantly + faster for large arrays. Parameters ---------- X : array - Input array. + Input array. Will be internally converted into an array of + doubles if needed. ratio : float A value in range [0, 1] defining the desired quantiles (the @@ -84,12 +87,15 @@ def _quantile(X, double ratio, int interp=False, int axis=0): # partial sorting as opposed to full sorting. def _median(X, axis=0): """ - Fast median computation using partial sorting. + Fast median computation using partial sorting. This function is + similar to `numpy.median` but runs significantly faster for large + arrays. Parameters ---------- X : array - Input array. + Input array. Will be internally converted into an array of + doubles if needed. axis : int Axis along which medians are computed. From e0d2cd3b838256a6c19024c7d255ea915c232156 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Wed, 14 Nov 2012 11:00:25 +0100 Subject: [PATCH 021/164] replace unsigned int with npy_intp to deal with array sizes/strides in quantile C-routine --- nipy/algorithms/statistics/_quantile.c | 514 ++++++++++++++--------- nipy/algorithms/statistics/_quantile.pyx | 10 +- nipy/algorithms/statistics/quantile.c | 36 +- nipy/algorithms/statistics/quantile.h | 7 +- 4 files changed, 332 insertions(+), 235 deletions(-) diff --git a/nipy/algorithms/statistics/_quantile.c b/nipy/algorithms/statistics/_quantile.c index 973add1415..032e6a3238 100644 --- a/nipy/algorithms/statistics/_quantile.c +++ b/nipy/algorithms/statistics/_quantile.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1 on Sat Oct 13 02:13:56 2012 */ +/* Generated by Cython 0.15.1 on Wed Nov 14 10:59:07 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -232,11 +232,11 @@ #include #define __PYX_HAVE__nipy__algorithms__statistics___quantile #define __PYX_HAVE_API__nipy__algorithms__statistics___quantile -#include "quantile.h" #include "stdio.h" #include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" +#include "quantile.h" #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -633,6 +633,8 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ @@ -641,6 +643,11 @@ static void __Pyx_RaiseDoubleKeywordsError( static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) @@ -668,8 +675,6 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje } } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; @@ -746,11 +751,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ - static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -938,15 +938,16 @@ int __pyx_module_is_main_nipy__algorithms__statistics___quantile = 0; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_5[] = "Non-native byte order not supported"; -static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_11[] = "Format string allocated too short."; -static char __pyx_k_13[] = "\nVery fast quantile computation using partial sorting.\nAuthor: Alexis Roche.\n"; -static char __pyx_k_14[] = "0.1"; -static char __pyx_k_15[] = "nipy.algorithms.statistics._quantile"; +static char __pyx_k_1[] = "ratio must be in range 0..1"; +static char __pyx_k_3[] = "ndarray is not C contiguous"; +static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_7[] = "Non-native byte order not supported"; +static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_13[] = "Format string allocated too short."; +static char __pyx_k_15[] = "\nVery fast quantile computation using partial sorting.\nAuthor: Alexis Roche.\n"; +static char __pyx_k_16[] = "0.1"; +static char __pyx_k_17[] = "nipy.algorithms.statistics._quantile"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -967,13 +968,16 @@ static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; static char __pyx_k__axis[] = "axis"; +static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__ratio[] = "ratio"; static char __pyx_k__shape[] = "shape"; static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__double[] = "double"; static char __pyx_k__interp[] = "interp"; static char __pyx_k___median[] = "_median"; +static char __pyx_k__asarray[] = "asarray"; static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; @@ -981,14 +985,15 @@ static char __pyx_k___quantile[] = "_quantile"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_11; -static PyObject *__pyx_kp_s_14; -static PyObject *__pyx_n_s_15; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_n_s_17; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; @@ -997,7 +1002,10 @@ static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s___median; static PyObject *__pyx_n_s___quantile; +static PyObject *__pyx_n_s__asarray; static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__double; +static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__interp; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; @@ -1012,20 +1020,21 @@ static PyObject *__pyx_int_15; static PyObject *__pyx_k_tuple_2; static PyObject *__pyx_k_tuple_4; static PyObject *__pyx_k_tuple_6; -static PyObject *__pyx_k_tuple_9; -static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_14; /* "nipy/algorithms/statistics/_quantile.pyx":24 - * # This is faster than scipy.stats.scoreatpercentile due to partial + * # This is faster than scipy.stats.scoreatpercentile owing to partial * # sorting * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< * """ - * q = quantile(data, ratio, interp=False, axis=0). + * Fast quantile computation using partial sorting. This function has */ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile[] = "\n q = quantile(data, ratio, interp=False, axis=0).\n\n Partial sorting algorithm, very fast!!!\n "; +static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile[] = "\n Fast quantile computation using partial sorting. This function has\n similar behavior to `scipy.percentile` but runs significantly\n faster for large arrays.\n\n Parameters\n ----------\n X : array\n Input array. Will be internally converted into an array of\n doubles if needed.\n\n ratio : float\n A value in range [0, 1] defining the desired quantiles (the\n higher the ratio, the higher the quantiles).\n\n interp : boolean\n Determine whether quantiles are interpolated.\n\n axis : int\n Axis along which quantiles are computed.\n\n Output\n ------\n Y : array\n Array of quantiles\n "; static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile = {__Pyx_NAMESTR("_quantile"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile)}; static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; @@ -1045,8 +1054,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - long __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1122,125 +1134,187 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __Pyx_INCREF(__pyx_v_X); + + /* "nipy/algorithms/statistics/_quantile.pyx":56 + * + * # Convert the input array to double if needed + * X = np.asarray(X, dtype='double') # <<<<<<<<<<<<<< + * + * # Check the input ratio is in range (0,1) + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_v_X); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X); + __Pyx_GIVEREF(__pyx_v_X); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__double)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_X); + __pyx_v_X = __pyx_t_4; + __pyx_t_4 = 0; + + /* "nipy/algorithms/statistics/_quantile.pyx":59 + * + * # Check the input ratio is in range (0,1) + * if ratio < 0 or ratio > 1: # <<<<<<<<<<<<<< + * raise ValueError('ratio must be in range 0..1') + * + */ + __pyx_t_5 = (__pyx_v_ratio < 0.0); + if (!__pyx_t_5) { + __pyx_t_6 = (__pyx_v_ratio > 1.0); + __pyx_t_7 = __pyx_t_6; + } else { + __pyx_t_7 = __pyx_t_5; + } + if (__pyx_t_7) { + + /* "nipy/algorithms/statistics/_quantile.pyx":60 + * # Check the input ratio is in range (0,1) + * if ratio < 0 or ratio > 1: + * raise ValueError('ratio must be in range 0..1') # <<<<<<<<<<<<<< + * + * # Allocate output array Y + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; - /* "nipy/algorithms/statistics/_quantile.pyx":35 + /* "nipy/algorithms/statistics/_quantile.pyx":63 * * # Allocate output array Y * dims = list(X.shape) # <<<<<<<<<<<<<< * dims[axis] = 1 * Y = np.zeros(dims) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_v_dims = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyList_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "nipy/algorithms/statistics/_quantile.pyx":36 + /* "nipy/algorithms/statistics/_quantile.pyx":64 * # Allocate output array Y * dims = list(X.shape) * dims[axis] = 1 # <<<<<<<<<<<<<< * Y = np.zeros(dims) * */ - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "nipy/algorithms/statistics/_quantile.pyx":37 + /* "nipy/algorithms/statistics/_quantile.pyx":65 * dims = list(X.shape) * dims[axis] = 1 * Y = np.zeros(dims) # <<<<<<<<<<<<<< * * # Set size and stride along specified axis */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_INCREF(((PyObject *)__pyx_v_dims)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dims)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_v_Y = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_Y = __pyx_t_1; + __pyx_t_1 = 0; - /* "nipy/algorithms/statistics/_quantile.pyx":40 + /* "nipy/algorithms/statistics/_quantile.pyx":68 * * # Set size and stride along specified axis * size = X.shape[axis] # <<<<<<<<<<<<<< * stride = X.strides[axis] / sizeof(double) * */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_size = __pyx_t_4; + __pyx_t_8 = __Pyx_PyInt_AsLong(__pyx_t_4); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_size = __pyx_t_8; - /* "nipy/algorithms/statistics/_quantile.pyx":41 + /* "nipy/algorithms/statistics/_quantile.pyx":69 * # Set size and stride along specified axis * size = X.shape[axis] * stride = X.strides[axis] / sizeof(double) # <<<<<<<<<<<<<< * * # Create array iterators */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__strides); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__strides); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_4, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, __pyx_v_axis, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(double))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_8 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_4 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_stride = __pyx_t_4; + __pyx_v_stride = __pyx_t_8; - /* "nipy/algorithms/statistics/_quantile.pyx":44 + /* "nipy/algorithms/statistics/_quantile.pyx":72 * * # Create array iterators * itX = np.PyArray_IterAllButAxis(X, &axis) # <<<<<<<<<<<<<< * itY = np.PyArray_IterAllButAxis(Y, &axis) * */ - __pyx_t_2 = PyArray_IterAllButAxis(__pyx_v_X, (&__pyx_v_axis)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_itX = ((PyArrayIterObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyArray_IterAllButAxis(__pyx_v_X, (&__pyx_v_axis)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itX = ((PyArrayIterObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "nipy/algorithms/statistics/_quantile.pyx":45 + /* "nipy/algorithms/statistics/_quantile.pyx":73 * # Create array iterators * itX = np.PyArray_IterAllButAxis(X, &axis) * itY = np.PyArray_IterAllButAxis(Y, &axis) # <<<<<<<<<<<<<< * * # Loop */ - __pyx_t_2 = PyArray_IterAllButAxis(__pyx_v_Y, (&__pyx_v_axis)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_itY = ((PyArrayIterObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_3 = PyArray_IterAllButAxis(__pyx_v_Y, (&__pyx_v_axis)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_itY = ((PyArrayIterObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "nipy/algorithms/statistics/_quantile.pyx":48 + /* "nipy/algorithms/statistics/_quantile.pyx":76 * * # Loop * while np.PyArray_ITER_NOTDONE(itX): # <<<<<<<<<<<<<< @@ -1248,10 +1322,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P * y = np.PyArray_ITER_DATA(itY) */ while (1) { - __pyx_t_5 = PyArray_ITER_NOTDONE(__pyx_v_itX); - if (!__pyx_t_5) break; + __pyx_t_7 = PyArray_ITER_NOTDONE(__pyx_v_itX); + if (!__pyx_t_7) break; - /* "nipy/algorithms/statistics/_quantile.pyx":49 + /* "nipy/algorithms/statistics/_quantile.pyx":77 * # Loop * while np.PyArray_ITER_NOTDONE(itX): * x = np.PyArray_ITER_DATA(itX) # <<<<<<<<<<<<<< @@ -1260,7 +1334,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P */ __pyx_v_x = ((double *)PyArray_ITER_DATA(__pyx_v_itX)); - /* "nipy/algorithms/statistics/_quantile.pyx":50 + /* "nipy/algorithms/statistics/_quantile.pyx":78 * while np.PyArray_ITER_NOTDONE(itX): * x = np.PyArray_ITER_DATA(itX) * y = np.PyArray_ITER_DATA(itY) # <<<<<<<<<<<<<< @@ -1269,7 +1343,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P */ __pyx_v_y = ((double *)PyArray_ITER_DATA(__pyx_v_itY)); - /* "nipy/algorithms/statistics/_quantile.pyx":51 + /* "nipy/algorithms/statistics/_quantile.pyx":79 * x = np.PyArray_ITER_DATA(itX) * y = np.PyArray_ITER_DATA(itY) * y[0] = quantile(x, size, stride, ratio, interp) # <<<<<<<<<<<<<< @@ -1278,7 +1352,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P */ (__pyx_v_y[0]) = quantile(__pyx_v_x, __pyx_v_size, __pyx_v_stride, __pyx_v_ratio, __pyx_v_interp); - /* "nipy/algorithms/statistics/_quantile.pyx":52 + /* "nipy/algorithms/statistics/_quantile.pyx":80 * y = np.PyArray_ITER_DATA(itY) * y[0] = quantile(x, size, stride, ratio, interp) * np.PyArray_ITER_NEXT(itX) # <<<<<<<<<<<<<< @@ -1287,7 +1361,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P */ PyArray_ITER_NEXT(__pyx_v_itX); - /* "nipy/algorithms/statistics/_quantile.pyx":53 + /* "nipy/algorithms/statistics/_quantile.pyx":81 * y[0] = quantile(x, size, stride, ratio, interp) * np.PyArray_ITER_NEXT(itX) * np.PyArray_ITER_NEXT(itY) # <<<<<<<<<<<<<< @@ -1297,7 +1371,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P PyArray_ITER_NEXT(__pyx_v_itY); } - /* "nipy/algorithms/statistics/_quantile.pyx":55 + /* "nipy/algorithms/statistics/_quantile.pyx":83 * np.PyArray_ITER_NEXT(itY) * * return Y # <<<<<<<<<<<<<< @@ -1315,6 +1389,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -1322,21 +1397,22 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_XDECREF((PyObject *)__pyx_v_itY); __Pyx_XDECREF(__pyx_v_dims); __Pyx_XDECREF(__pyx_v_Y); + __Pyx_XDECREF(__pyx_v_X); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "nipy/algorithms/statistics/_quantile.pyx":60 +/* "nipy/algorithms/statistics/_quantile.pyx":88 * # due to the underlying algorithm that relies on * # partial sorting as opposed to full sorting. * def _median(X, axis=0): # <<<<<<<<<<<<<< * """ - * median(X, axis=0) + * Fast median computation using partial sorting. This function is */ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median[] = "\n median(X, axis=0)\n "; +static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median[] = "\n Fast median computation using partial sorting. This function is\n similar to `numpy.median` but runs significantly faster for large\n arrays.\n\n Parameters\n ----------\n X : array\n Input array. Will be internally converted into an array of\n doubles if needed.\n\n axis : int\n Axis along which medians are computed.\n\n Output\n ------\n Y : array\n Array of medians\n "; static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median = {__Pyx_NAMESTR("_median"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median)}; static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; @@ -1377,7 +1453,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1392,39 +1468,39 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_median", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_median", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("nipy.algorithms.statistics._quantile._median", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - /* "nipy/algorithms/statistics/_quantile.pyx":64 - * median(X, axis=0) + /* "nipy/algorithms/statistics/_quantile.pyx":108 + * Array of medians * """ * return _quantile(X, axis=axis, ratio=0.5, interp=True) # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___quantile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___quantile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_v_axis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_v_axis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ratio), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ratio), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__interp), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__interp), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -1594,7 +1670,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -1634,7 +1710,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -1904,7 +1980,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -2144,7 +2220,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2676,7 +2752,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -2727,7 +2803,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -2832,7 +2908,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3178,7 +3254,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); @@ -3392,7 +3468,7 @@ static PyMethodDef __pyx_methods[] = { static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("_quantile"), - __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_15), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3403,14 +3479,15 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, - {&__pyx_n_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 1}, + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, @@ -3419,7 +3496,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s___median, __pyx_k___median, sizeof(__pyx_k___median), 0, 0, 1, 1}, {&__pyx_n_s___quantile, __pyx_k___quantile, sizeof(__pyx_k___quantile), 0, 0, 1, 1}, + {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, @@ -3431,7 +3511,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -3443,6 +3523,20 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + /* "nipy/algorithms/statistics/_quantile.pyx":60 + * # Check the input ratio is in range (0,1) + * if ratio < 0 or ratio > 1: + * raise ValueError('ratio must be in range 0..1') # <<<<<<<<<<<<<< + * + * # Allocate output array Y + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): @@ -3450,12 +3544,12 @@ static int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) @@ -3464,12 +3558,12 @@ static int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or @@ -3478,12 +3572,12 @@ static int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); /* "numpy.pxd":795 * @@ -3492,12 +3586,12 @@ static int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or @@ -3506,12 +3600,12 @@ static int __Pyx_InitCachedConstants(void) { * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); /* "numpy.pxd":819 * t = child.type_num @@ -3520,12 +3614,12 @@ static int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); - PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3578,7 +3672,7 @@ PyMODINIT_FUNC PyInit__quantile(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_quantile"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_quantile"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -3617,53 +3711,53 @@ PyMODINIT_FUNC PyInit__quantile(void) * * __version__ = '0.1' # <<<<<<<<<<<<<< * - * cdef extern from "quantile.h": + * import numpy as np */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "nipy/algorithms/statistics/_quantile.pyx":17 - * int interp) + /* "nipy/algorithms/statistics/_quantile.pyx":10 + * __version__ = '0.1' * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "nipy/algorithms/statistics/_quantile.pyx":20 - * cimport numpy as np + * int interp) * * np.import_array() # <<<<<<<<<<<<<< * - * # This is faster than scipy.stats.scoreatpercentile due to partial + * # This is faster than scipy.stats.scoreatpercentile owing to partial */ import_array(); /* "nipy/algorithms/statistics/_quantile.pyx":24 - * # This is faster than scipy.stats.scoreatpercentile due to partial + * # This is faster than scipy.stats.scoreatpercentile owing to partial * # sorting * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< * """ - * q = quantile(data, ratio, interp=False, axis=0). + * Fast quantile computation using partial sorting. This function has */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile, NULL, __pyx_n_s_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___quantile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "nipy/algorithms/statistics/_quantile.pyx":60 + /* "nipy/algorithms/statistics/_quantile.pyx":88 * # due to the underlying algorithm that relies on * # partial sorting as opposed to full sorting. * def _median(X, axis=0): # <<<<<<<<<<<<<< * """ - * median(X, axis=0) + * Fast median computation using partial sorting. This function is */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median, NULL, __pyx_n_s_15); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___median, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___median, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "nipy/algorithms/statistics/_quantile.pyx":1 @@ -3719,6 +3813,21 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { } #endif /* CYTHON_REFNANNY */ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; +} + static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, @@ -3837,35 +3946,6 @@ static int __Pyx_ParseOptionalKeywords( return -1; } - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) { - if (dict != __pyx_b) { - PyErr_Clear(); - result = PyObject_GetAttr(__pyx_b, name); - } - if (!result) { - PyErr_SetObject(PyExc_NameError, name); - } - } - return result; -} - - -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -4027,6 +4107,20 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif + + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", diff --git a/nipy/algorithms/statistics/_quantile.pyx b/nipy/algorithms/statistics/_quantile.pyx index dd2f077e8a..3307cd7cbc 100644 --- a/nipy/algorithms/statistics/_quantile.pyx +++ b/nipy/algorithms/statistics/_quantile.pyx @@ -7,16 +7,16 @@ Author: Alexis Roche. __version__ = '0.1' +import numpy as np +cimport numpy as np + cdef extern from "quantile.h": double quantile(double* data, - unsigned long size, - unsigned long stride, + np.npy_intp size, + np.npy_intp stride, double r, int interp) -import numpy as np -cimport numpy as np - np.import_array() # This is faster than scipy.stats.scoreatpercentile owing to partial diff --git a/nipy/algorithms/statistics/quantile.c b/nipy/algorithms/statistics/quantile.c index 46607e0bed..0a6ca127ab 100644 --- a/nipy/algorithms/statistics/quantile.c +++ b/nipy/algorithms/statistics/quantile.c @@ -16,15 +16,15 @@ /* Declaration of static functions */ static double _pth_element(double* x, - unsigned long p, - unsigned long stride, - unsigned long size); + npy_intp p, + npy_intp stride, + npy_intp size); static void _pth_interval(double* am, double* aM, double* x, - unsigned long p, - unsigned long stride, - unsigned long size); + npy_intp p, + npy_intp stride, + npy_intp size); /* Quantile. @@ -34,13 +34,13 @@ static void _pth_interval(double* am, or equal to (1-r) * sample size. */ double quantile(double* data, - unsigned long size, - unsigned long stride, + npy_intp size, + npy_intp stride, double r, int interp) { double m, pp; - unsigned long p; + npy_intp p; if ((r<0) || (r>1)){ fprintf(stderr, "Ratio must be in [0,1], returning zero"); @@ -88,13 +88,13 @@ double quantile(double* data, static double _pth_element(double* x, - unsigned long p, - unsigned long stride, - unsigned long n) + npy_intp p, + npy_intp stride, + npy_intp n) { double a, tmp; double *bufl, *bufr; - unsigned long i, j, il, jr, stop1, stop2; + npy_intp i, j, il, jr, stop1, stop2; int same_extremities; stop1 = 0; @@ -170,14 +170,14 @@ static double _pth_element(double* x, static void _pth_interval(double* am, double* aM, double* x, - unsigned long p, - unsigned long stride, - unsigned long n) + npy_intp p, + npy_intp stride, + npy_intp n) { double a, tmp; double *bufl, *bufr; - unsigned long i, j, il, jr, stop1, stop2, stop3; - unsigned long pp = p+1; + npy_intp i, j, il, jr, stop1, stop2, stop3; + npy_intp pp = p+1; int same_extremities = 0; *am = 0.0; diff --git a/nipy/algorithms/statistics/quantile.h b/nipy/algorithms/statistics/quantile.h index 7e4717e9d6..9db1db9aa2 100644 --- a/nipy/algorithms/statistics/quantile.h +++ b/nipy/algorithms/statistics/quantile.h @@ -5,9 +5,12 @@ extern "C" { #endif +#include +#include + extern double quantile(double* data, - unsigned long size, - unsigned long stride, + npy_intp size, + npy_intp stride, double r, int interp); From 4a4f20e960413c6d81581c804460c914ec673638 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Thu, 15 Nov 2012 08:43:54 +0100 Subject: [PATCH 022/164] more comprehensive median/quantile tests --- .../statistics/tests/test_quantile.py | 82 +++++++++++++++---- 1 file changed, 67 insertions(+), 15 deletions(-) diff --git a/nipy/algorithms/statistics/tests/test_quantile.py b/nipy/algorithms/statistics/tests/test_quantile.py index 7791e3380a..64974c7ddd 100644 --- a/nipy/algorithms/statistics/tests/test_quantile.py +++ b/nipy/algorithms/statistics/tests/test_quantile.py @@ -3,21 +3,73 @@ import numpy as np from .._quantile import _quantile, _median -from numpy.testing import assert_array_equal - -def test_median(): - X = np.array([np.arange(11) for i in range(20)]) - assert_array_equal(_median(X, axis=1).squeeze(), - 5 * np.ones(20)) - assert_array_equal(_median(X.T.astype('double')).squeeze(), - 5 * np.ones(20)) - -def test_quantile(): - X = np.array([np.arange(1, 10) for i in range(20)]) - assert_array_equal(_quantile(X, axis=1, ratio=.8).squeeze(), - 9 * np.ones(20)) - assert_array_equal(_quantile(X.T.astype('double'), ratio=.8).squeeze(), - 9 * np.ones(20)) +from numpy.testing import (assert_array_equal, + assert_array_almost_equal) +from numpy import median as np_median +from scipy import percentile as sp_percentile + + +def _test_median(dtype, shape): + X = (100 * (np.random.random(shape) - .5)).astype(dtype) + for a in range(X.ndim): + assert_array_equal(_median(X, axis=a).squeeze(), + np_median(X, axis=a)) + + +def _test_quantile(dtype, shape): + X = (100 * (np.random.random(shape) - .5)).astype(dtype) + for a in range(X.ndim): + assert_array_almost_equal(\ + _quantile(X, .75, axis=a, interp=True).squeeze(), + sp_percentile(X, 75, axis=a)) + + +def test_median_2d_int32(): + _test_median('int32', (10, 11)) + + +def test_median_3d_int32(): + _test_median('int32', (10, 11, 12)) + + +def test_median_2d_uint8(): + _test_median('uint8', (10, 11)) + + +def test_median_3d_uint8(): + _test_median('uint8', (10, 11, 12)) + + +def test_median_2d_double(): + _test_median('double', (10, 11)) + + +def test_median_3d_double(): + _test_median('double', (10, 11, 12)) + + +def test_quantile_2d_int32(): + _test_quantile('int32', (10, 11)) + + +def test_quantile_3d_int32(): + _test_quantile('int32', (10, 11, 12)) + + +def test_quantile_2d_uint8(): + _test_quantile('uint8', (10, 11)) + + +def test_quantile_3d_uint8(): + _test_quantile('uint8', (10, 11, 12)) + + +def test_quantile_2d_double(): + _test_quantile('double', (10, 11)) + + +def test_quantile_3d_double(): + _test_quantile('double', (10, 11, 12)) if __name__ == "__main__": From 512618efba66776e3213632e91d26f511646fb16 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 15 Nov 2012 18:27:54 -0800 Subject: [PATCH 023/164] RF: extend quantile and median tests Make single test functions run many tests. --- .../statistics/tests/test_quantile.py | 81 +++++-------------- 1 file changed, 22 insertions(+), 59 deletions(-) diff --git a/nipy/algorithms/statistics/tests/test_quantile.py b/nipy/algorithms/statistics/tests/test_quantile.py index 64974c7ddd..24d66f438e 100644 --- a/nipy/algorithms/statistics/tests/test_quantile.py +++ b/nipy/algorithms/statistics/tests/test_quantile.py @@ -1,75 +1,38 @@ #!/usr/bin/env python import numpy as np - -from .._quantile import _quantile, _median -from numpy.testing import (assert_array_equal, - assert_array_almost_equal) from numpy import median as np_median -from scipy import percentile as sp_percentile - - -def _test_median(dtype, shape): - X = (100 * (np.random.random(shape) - .5)).astype(dtype) - for a in range(X.ndim): - assert_array_equal(_median(X, axis=a).squeeze(), - np_median(X, axis=a)) - - -def _test_quantile(dtype, shape): - X = (100 * (np.random.random(shape) - .5)).astype(dtype) - for a in range(X.ndim): - assert_array_almost_equal(\ - _quantile(X, .75, axis=a, interp=True).squeeze(), - sp_percentile(X, 75, axis=a)) - - -def test_median_2d_int32(): - _test_median('int32', (10, 11)) - - -def test_median_3d_int32(): - _test_median('int32', (10, 11, 12)) - - -def test_median_2d_uint8(): - _test_median('uint8', (10, 11)) +from scipy import percentile as sp_percentile -def test_median_3d_uint8(): - _test_median('uint8', (10, 11, 12)) - - -def test_median_2d_double(): - _test_median('double', (10, 11)) - - -def test_median_3d_double(): - _test_median('double', (10, 11, 12)) - - -def test_quantile_2d_int32(): - _test_quantile('int32', (10, 11)) - - -def test_quantile_3d_int32(): - _test_quantile('int32', (10, 11, 12)) - +from .._quantile import _quantile, _median -def test_quantile_2d_uint8(): - _test_quantile('uint8', (10, 11)) +from numpy.testing import (assert_array_equal, + assert_array_almost_equal) -def test_quantile_3d_uint8(): - _test_quantile('uint8', (10, 11, 12)) +NUMERIC_TYPES = sum([np.sctypes[t] + for t in ('int', 'uint', 'float', 'complex')], + []) -def test_quantile_2d_double(): - _test_quantile('double', (10, 11)) +def test_median(): + for dtype in NUMERIC_TYPES: + for shape in ((10,), (10, 11), (10, 11, 12)): + X = (100 * (np.random.random(shape) - .5)).astype(dtype) + for a in range(X.ndim): + assert_array_equal(_median(X, axis=a).squeeze(), + np_median(X.astype(np.float64), axis=a)) -def test_quantile_3d_double(): - _test_quantile('double', (10, 11, 12)) +def test_quantile(): + for dtype in NUMERIC_TYPES: + for shape in ((10,), (10, 11), (10, 11, 12)): + X = (100 * (np.random.random(shape) - .5)).astype(dtype) + for a in range(X.ndim): + assert_array_almost_equal( + _quantile(X, .75, axis=a, interp=True).squeeze(), + sp_percentile(X, 75, axis=a)) if __name__ == "__main__": From f5a998180415a41f2e5b7fac8d4eb58ef3b859b0 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Fri, 16 Nov 2012 14:12:51 +0100 Subject: [PATCH 024/164] review realign4d code and fixed test failure --- nipy/algorithms/optimize.py | 15 ++++---- .../registration/groupwise_registration.py | 35 ++++++++++++------- .../registration/tests/test_fmri_realign4d.py | 18 ++++++---- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/nipy/algorithms/optimize.py b/nipy/algorithms/optimize.py index 9f542de52d..8e18c0bfbd 100644 --- a/nipy/algorithms/optimize.py +++ b/nipy/algorithms/optimize.py @@ -29,8 +29,8 @@ def wrapper(x): def fmin_steepest(f, x0, fprime=None, xtol=1e-4, ftol=1e-4, - step=_STEP, - maxiter=None, callback=None): + step=_STEP, maxiter=None, callback=None, + disp=True): x = np.asarray(x0).flatten() fval = np.squeeze(f(x)) @@ -46,18 +46,21 @@ def fmin_steepest(f, x0, fprime=None, xtol=1e-4, ftol=1e-4, it = it + 1 x0 = x fval0 = fval - print('Computing gradient...') + if disp: + print('Computing gradient...') direc = myfprime(x) direc = direc / np.sqrt(np.sum(direc**2)) - print('Performing line search...') + if disp: + print('Performing line search...') fval, x = _linesearch_brent(f, x, direc, tol=xtol*100) if not callback == None: callback(x) if (2.0*(fval0-fval) <= ftol*(abs(fval0)+abs(fval))+1e-20): break - print('Number of iterations: %d' % it) - print('Minimum criterion value: %f' % fval) + if disp: + print('Number of iterations: %d' % it) + print('Minimum criterion value: %f' % fval) return x diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index 81ba443941..77e0485b5d 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -111,21 +111,32 @@ def __init__(self, data, affine, tr, tr_slices=None, start=0.0, if isinstance(data, np.ndarray): self._data = data + self._shape = data.shape self._get_data = None self._init_timing_parameters() else: self._data = None + self._shape = None self._get_data = data + def _load_data(self): + self._data = self._get_data() + self._shape = self._data.shape + self._init_timing_parameters() + def get_data(self): if self._data == None: - self._data = self._get_data() - self._init_timing_parameters() + self._load_data() return self._data + + def get_shape(self): + if self._shape == None: + self._load_data() + return self._shape def _init_timing_parameters(self): # Number of slices - nslices = self.get_data().shape[self.slice_axis] + nslices = self.get_shape()[self.slice_axis] self.nslices = nslices # Default slice repetition time (no silence) if self._tr_slices == None: @@ -196,7 +207,7 @@ def __init__(self, maxfun=MAXFUN, refscan=REFSCAN): - self.dims = im4d.get_data().shape + self.dims = im4d.get_shape() self.nscans = self.dims[3] self.xyz = make_grid(self.dims[0:3], subsampling, borders) masksize = self.xyz.shape[0] @@ -422,7 +433,7 @@ def fhess(pc): # multiscale pyramid. To avoid crashes, we insert a try/catch # instruction. try: - pc = fmin(f, self.transforms[t].param, *args, **kwargs) + pc = fmin(f, self.transforms[t].param, disp=False, *args, **kwargs) self.set_transform(t, pc) except: warnings.warn('Minimization failed') @@ -508,13 +519,12 @@ def single_run_realign4d(im4d, If a sequence, implement a multi-scale """ - if not hasattr(loops, '__iter__'): + if not type(loops) in (list, tuple, np.array): loops = [loops] repeats = len(loops) def format_arg(x): - if isinstance(x, basestring) or not hasattr(x, '__iter__'): - # str has __iter__ in Python 3 + if not type(x) in (list, tuple, np.array): x = [x for i in range(repeats)] else: if not len(x) == repeats: @@ -537,7 +547,8 @@ def format_arg(x): for loops_, speedup_, optimizer_, xtol_, ftol_, gtol_,\ stepsize_, maxiter_, maxfun_ in opt_params: - subsampling = adjust_subsampling(speedup_, im4d.get_data().shape[0:3]) + subsampling = adjust_subsampling(speedup_, im4d.get_shape()[0:3]) + r = Realign4dAlgorithm(im4d, transforms=transforms, affine_class=affine_class, @@ -597,7 +608,7 @@ def realign4d(runs, """ # Single-session case - if not hasattr(runs, '__iter__'): + if not type(runs) in (list, tuple, np.array): runs = [runs] nruns = len(runs) if nruns == 1: @@ -625,7 +636,7 @@ def realign4d(runs, # corrected run, and creating a fake time series with no temporal # smoothness ## FIXME: check that all runs have the same to-world transform - mean_img_shape = list(runs[0].get_data().shape[0:3]) + [nruns] + mean_img_shape = list(runs[0].get_shape()[0:3]) + [nruns] mean_img_data = np.zeros(mean_img_shape) for i in range(nruns): @@ -674,7 +685,7 @@ def _generic_init(self, images, affine_class, time_interp = False if tr == None: raise ValueError('Repetition time cannot be None') - if not hasattr(images, '__iter__'): + if not type(images) in (list, tuple, np.array): images = [images] self._runs = [] self.affine_class = affine_class diff --git a/nipy/algorithms/registration/tests/test_fmri_realign4d.py b/nipy/algorithms/registration/tests/test_fmri_realign4d.py index 2a67f4fc24..4d4ab12919 100644 --- a/nipy/algorithms/registration/tests/test_fmri_realign4d.py +++ b/nipy/algorithms/registration/tests/test_fmri_realign4d.py @@ -90,12 +90,18 @@ def test_realign4d(): orient = io_orientation(im.affine) slice_axis = int(np.where(orient[:, 0] == 2)[0]) R1 = FmriRealign4d(runs, tr=2., slice_order='ascending') - R1.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) + R1.estimate(refscan=None, loops=1, between_loops=1, optimizer='steepest') R2 = FmriRealign4d(runs, tr=2., slice_order=range(im.shape[slice_axis])) - R2.estimate(refscan=None, loops=(1, 0), between_loops=(1, 0)) + R2.estimate(refscan=None, loops=1, between_loops=1, optimizer='steepest') for r in range(2): for i in range(im.shape[3]): - assert_array_almost_equal(R1._transforms[r][i].as_affine(), - R2._transforms[r][i].as_affine()) - assert_array_almost_equal(R1._mean_transforms[r].as_affine(), - R2._mean_transforms[r].as_affine()) + assert_array_almost_equal(R1._transforms[r][i].translation, + R2._transforms[r][i].translation) + assert_array_almost_equal(R1._transforms[r][i].rotation, + R2._transforms[r][i].rotation) + for i in range(im.shape[3]): + assert_array_almost_equal(R1._mean_transforms[r].translation, + R2._mean_transforms[r].translation) + assert_array_almost_equal(R1._mean_transforms[r].rotation, + R2._mean_transforms[r].rotation) + From b164904b815889e9deee16a8b0e811cca5df1cff Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Fri, 16 Nov 2012 19:03:42 +0100 Subject: [PATCH 025/164] added comment to explain the test --- .../registration/tests/test_fmri_realign4d.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nipy/algorithms/registration/tests/test_fmri_realign4d.py b/nipy/algorithms/registration/tests/test_fmri_realign4d.py index 4d4ab12919..4b6caab647 100644 --- a/nipy/algorithms/registration/tests/test_fmri_realign4d.py +++ b/nipy/algorithms/registration/tests/test_fmri_realign4d.py @@ -86,6 +86,18 @@ def test_realign4d_no_time_interp(): def test_realign4d(): + """ + This tests whether realign4d yields the same results depending on + whether the slice order is input explicitely or as + slice_order='ascending'. + + Due to the very small size of the image used for testing (only 3 + slices), optimization is numerically unstable. It seems to make + the default optimizer, namely scipy.fmin.fmin_ncg, adopt a random + behavior. To work around the resulting inconsistency in results, + we use nipy.optimize.fmin_steepest as the optimizer, although it's + generally not recommended in practice. + """ runs = [im, im] orient = io_orientation(im.affine) slice_axis = int(np.where(orient[:, 0] == 2)[0]) From 7f708afbb7cdacb042337408c9a8014c94fd54b6 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Sat, 17 Nov 2012 22:49:50 +0100 Subject: [PATCH 026/164] display minimization messages by default --- nipy/algorithms/registration/groupwise_registration.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/algorithms/registration/groupwise_registration.py b/nipy/algorithms/registration/groupwise_registration.py index 77e0485b5d..e4133e764e 100644 --- a/nipy/algorithms/registration/groupwise_registration.py +++ b/nipy/algorithms/registration/groupwise_registration.py @@ -433,7 +433,7 @@ def fhess(pc): # multiscale pyramid. To avoid crashes, we insert a try/catch # instruction. try: - pc = fmin(f, self.transforms[t].param, disp=False, *args, **kwargs) + pc = fmin(f, self.transforms[t].param, disp=VERBOSE, *args, **kwargs) self.set_transform(t, pc) except: warnings.warn('Minimization failed') From bd7dc4e3cc48f98c190bf462d0ee4315503b3ac7 Mon Sep 17 00:00:00 2001 From: Alexis Roche Date: Tue, 20 Nov 2012 10:11:48 +0100 Subject: [PATCH 027/164] Cleaned and documented steepest descent routine --- nipy/algorithms/optimize.py | 37 +++++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/nipy/algorithms/optimize.py b/nipy/algorithms/optimize.py index 8e18c0bfbd..8cfc109a07 100644 --- a/nipy/algorithms/optimize.py +++ b/nipy/algorithms/optimize.py @@ -5,7 +5,6 @@ import numpy as np from scipy.optimize import brent, approx_fprime -_STEP = np.sqrt(np.finfo(float).eps) def _linesearch_brent(func, p, xi, tol=1e-3): @@ -29,9 +28,39 @@ def wrapper(x): def fmin_steepest(f, x0, fprime=None, xtol=1e-4, ftol=1e-4, - step=_STEP, maxiter=None, callback=None, - disp=True): + maxiter=None, callback=None, disp=True): + """ + Minimize a function using a steepest gradient descent + algorithm. This complements the collection of minimization + routines provided in scipy.optimize. Steepest gradient iterations + are cheaper than in the conjugate gradient or Newton methods, + hence convergence may sometimes turn out faster algthough more + iterations are typically needed. + + Parameters + ---------- + f : callable + Function to be minimized + x0 : array + Starting point + fprime : callable + Function that computes the gradient of f + xtol : float + Relative tolerance on step sizes in line searches + ftol : float + Relative tolerance on function variations + maxiter : int + Maximum number of iterations + callback : callable + Optional function called after each iteration is complete + disp : bool + Print convergence message if True + Returns + ------- + x : array + Gradient descent fix point, local minimizer of f + """ x = np.asarray(x0).flatten() fval = np.squeeze(f(x)) it = 0 @@ -52,7 +81,7 @@ def fmin_steepest(f, x0, fprime=None, xtol=1e-4, ftol=1e-4, direc = direc / np.sqrt(np.sum(direc**2)) if disp: print('Performing line search...') - fval, x = _linesearch_brent(f, x, direc, tol=xtol*100) + fval, x = _linesearch_brent(f, x, direc, tol=xtol) if not callback == None: callback(x) if (2.0*(fval0-fval) <= ftol*(abs(fval0)+abs(fval))+1e-20): From d2a69390cf8ec4dfb0ce25ab47d42ee6ef3d48d1 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 20 Nov 2012 19:07:26 -0800 Subject: [PATCH 028/164] BF: fix badly considered import by some loser* * Yes, the loser was me --- nipy/algorithms/statistics/tests/test_quantile.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nipy/algorithms/statistics/tests/test_quantile.py b/nipy/algorithms/statistics/tests/test_quantile.py index 24d66f438e..ff0a89e9cf 100644 --- a/nipy/algorithms/statistics/tests/test_quantile.py +++ b/nipy/algorithms/statistics/tests/test_quantile.py @@ -16,6 +16,10 @@ []) +def another_percentile(arr, pct, axis): + return np.apply_along_axis(sp_percentile, axis, arr.astype(float), pct) + + def test_median(): for dtype in NUMERIC_TYPES: for shape in ((10,), (10, 11), (10, 11, 12)): From 1d81f036b8133bf0be3fd017a7c42619be983c3a Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 21 Nov 2012 00:47:11 -0800 Subject: [PATCH 029/164] BF: apply correct fix to quartile test I applied half of the fix in the previous commit by getting confused with a git stash --- nipy/algorithms/statistics/tests/test_quantile.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/statistics/tests/test_quantile.py b/nipy/algorithms/statistics/tests/test_quantile.py index ff0a89e9cf..c6ec6671d5 100644 --- a/nipy/algorithms/statistics/tests/test_quantile.py +++ b/nipy/algorithms/statistics/tests/test_quantile.py @@ -3,7 +3,7 @@ import numpy as np from numpy import median as np_median -from scipy import percentile as sp_percentile +from scipy.stats import scoreatpercentile as sp_percentile from .._quantile import _quantile, _median @@ -17,6 +17,7 @@ def another_percentile(arr, pct, axis): + # numpy.percentile not available until after numpy 1.4.1 return np.apply_along_axis(sp_percentile, axis, arr.astype(float), pct) @@ -36,7 +37,7 @@ def test_quantile(): for a in range(X.ndim): assert_array_almost_equal( _quantile(X, .75, axis=a, interp=True).squeeze(), - sp_percentile(X, 75, axis=a)) + another_percentile(X, 75, axis=a)) if __name__ == "__main__": From b1538a36797490fe8c18596e2236150335b733d4 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 14 Sep 2012 15:55:20 +0100 Subject: [PATCH 030/164] NF: script to run examples A python script to run examples and pump logs to specified directory. --- tools/run_log_examples.py | 123 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 tools/run_log_examples.py diff --git a/tools/run_log_examples.py b/tools/run_log_examples.py new file mode 100755 index 0000000000..62cc0fc8aa --- /dev/null +++ b/tools/run_log_examples.py @@ -0,0 +1,123 @@ +#!/usr/bin/env python +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function, with_statement + +DESCRIP = 'Run and log examples' +EPILOG = \ +""" Run examples in directory + +Typical usage is: + +run_log_examples.py nipy/examples --log-path=~/tmp/eg_logs +""" + +import sys +import os +from os.path import abspath, expanduser, join as pjoin, sep as psep +from subprocess import Popen +import re + +from nipy.externals.argparse import (ArgumentParser, + RawDescriptionHelpFormatter) + + +PYTHON=sys.executable +NEED_SHELL = True + +class ProcLogger(object): + def __init__(self, log_path, working_path): + self.log_path = log_path + self.working_path = working_path + self._names = [] + + def cmd_str_maker(self, cmd, args): + return " ".join([cmd] + list(args)) + + def __call__(self, cmd_name, cmd, args=(), cwd=None): + # Mqke log files + if cmd_name in self._names: + raise ValueError('Command name {0} not unique'.format(cmd_name)) + self._names.append(cmd_name) + if cwd is None: + cwd = self.working_path + cmd_out_path = pjoin(self.log_path, cmd_name) + stdout_log = open(cmd_out_path + '.stdout', 'wt') + stderr_log = open(cmd_out_path + '.stderr', 'wt') + try: + # Start subprocess + cmd_str = self.cmd_str_maker(cmd, args) + proc = Popen(cmd_str, + cwd = cwd, + stdout = stdout_log, + stderr = stderr_log, + shell = NEED_SHELL) + # Execute + retcode = proc.wait() + finally: + if proc.poll() is None: # In case we get killed + proc.terminate() + stdout_log.close() + stderr_log.close() + return retcode + + +class PyProcLogger(ProcLogger): + def cmd_str_maker(self, cmd, args): + """ Execute python script `cmd` + + Reject any `args` because we're using ``exec`` to execute the script. + + Prepend some matplotlib setup to suppress figures + """ + if len(args) != 0: + raise ValueError("Cannot use args with {8}".format(self.__class__)) + return("""{0} -c "import matplotlib as mpl; mpl.use('agg'); """ + """exec(open('{1}', 'rt').read())" """.format(PYTHON, cmd)) + + +def main(): + parser = ArgumentParser(description=DESCRIP, + epilog=EPILOG, + formatter_class=RawDescriptionHelpFormatter) + parser.add_argument('examples_path', type=str, + help='directory containing examples') + parser.add_argument('--log-path', type=str, required=True, + help='path for output logs') + parser.add_argument('--excludex', type=str, action='append', default=[], + help='regex for files to exclude (add more than one ' + '--excludex option for more than one regex filter') + args = parser.parse_args() + # Proc runner + eg_path = abspath(expanduser(args.examples_path)) + log_path = abspath(expanduser(args.log_path)) + excludexes = [re.compile(s) for s in args.excludex] + proc_logger = PyProcLogger(log_path=log_path, + working_path=eg_path) + fails = 0 + with open(pjoin(log_path, 'summary.txt'), 'wt') as f: + for dirpath, dirnames, filenames in os.walk(eg_path): + for fname in filenames: + if fname.endswith(".py"): + print(fname, end=': ') + sys.stdout.flush() + for excludex in excludexes: + if excludex.search(fname): + result_str = "SKIP" + fail = 0 + break + else: + full_fname = pjoin(dirpath, fname) + cmd_name = full_fname.replace(eg_path + psep, '') + cmd_name = cmd_name.replace(psep, '-') + code = proc_logger(cmd_name, full_fname, cwd=dirpath) + fail = code != 0 + result_str = "FAIL" if fail else "OK" + print(result_str) + f.write('{0}: {1}\n'.format(fname, result_str)) + fails += fail + exit(fails if fails < 255 else 255) + + +if __name__ == '__main__': + main() From d0ada7d7fe82d61e2b1339f9d99457cbe8fc4e1a Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 15 Sep 2012 12:31:52 +0100 Subject: [PATCH 031/164] RF: make examples compatible with Python 3 And therefore not compatible with Python 2.5. But, if you want Python 2.5 badly, it's obvious what to do. --- examples/affine_registration.py | 9 +++--- .../algorithms/bayesian_gaussian_mixtures.py | 8 +++-- examples/algorithms/clustering_comparisons.py | 8 +++-- .../algorithms/gaussian_mixture_models.py | 4 ++- examples/algorithms/ward_clustering.py | 8 +++-- examples/compute_fmri_contrast.py | 7 +++-- .../data_package/nipy-examplepkg/setup.py | 7 +++-- examples/fiac/fiac_example.py | 5 ++-- examples/fiac/fiac_util.py | 11 +++++-- examples/fiac/view_contrasts_3d.py | 5 ++-- examples/formula/multi_session_contrast.py | 8 +++-- examples/formula/simple_contrast.py | 3 +- examples/interfaces/process_fiac.py | 5 ++-- examples/labs/bayesian_structural_analysis.py | 4 ++- examples/labs/blob_extraction.py | 4 ++- examples/labs/demo_dmtx.py | 12 ++++---- examples/labs/example_glm.py | 8 +++-- examples/labs/glm_lowlevel.py | 10 ++++--- .../labs/group_reproducibility_analysis.py | 4 ++- examples/labs/hierarchical_rois.py | 5 +++- examples/labs/histogram_fits.py | 3 +- examples/labs/multi_subject_parcellation.py | 3 +- .../need_data/bayesian_structural_analysis.py | 11 +++---- .../labs/need_data/demo_blob_from_image.py | 9 +++--- examples/labs/need_data/demo_roi.py | 9 +++--- .../labs/need_data/demo_ward_clustering.py | 6 ++-- .../labs/need_data/example_roi_and_glm.py | 7 +++-- examples/labs/need_data/first_level_fiac.py | 9 +++--- examples/labs/need_data/get_data_light.py | 30 +++++++++++-------- .../group_reproducibility_analysis.py | 8 ++--- examples/labs/need_data/histogram_fits.py | 1 + examples/labs/need_data/localizer_glm_ar.py | 19 ++++++------ examples/labs/need_data/parcel_intra.py | 3 +- examples/labs/need_data/parcel_multisubj.py | 3 +- examples/labs/need_data/permutation_test.py | 3 +- examples/labs/need_data/plot_registration.py | 3 +- examples/labs/need_data/viz.py | 7 +++-- examples/labs/permutation_test_fakedata.py | 9 +++--- examples/labs/two_sample_mixed_effects.py | 5 ++-- examples/labs/watershed_labeling.py | 3 +- examples/labs/write_paradigm_file.py | 5 ++-- examples/space_time_realign.py | 4 ++- examples/tissue_classification.py | 2 ++ 43 files changed, 181 insertions(+), 116 deletions(-) diff --git a/examples/affine_registration.py b/examples/affine_registration.py index 06237346ae..48feeb0a93 100755 --- a/examples/affine_registration.py +++ b/examples/affine_registration.py @@ -8,6 +8,7 @@ is 'ammon' and the target is 'anubis'. Running it will result in a resampled ammon image being created in the current directory. """ +from __future__ import print_function # Python 2/3 compatibility from optparse import OptionParser import time @@ -64,10 +65,10 @@ optimizer = opts.optimizer # Print messages -print ('Source brain: %s' % source) -print ('Target brain: %s' % target) -print ('Similarity measure: %s' % similarity) -print ('Optimizer: %s' % optimizer) +print('Source brain: %s' % source) +print('Target brain: %s' % target) +print('Similarity measure: %s' % similarity) +print('Optimizer: %s' % optimizer) # Get data print('Fetching image data...') diff --git a/examples/algorithms/bayesian_gaussian_mixtures.py b/examples/algorithms/bayesian_gaussian_mixtures.py index 8518670ba1..17e647b19e 100755 --- a/examples/algorithms/bayesian_gaussian_mixtures.py +++ b/examples/algorithms/bayesian_gaussian_mixtures.py @@ -12,7 +12,9 @@ Author : Bertrand Thirion, 2008-2010 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np import numpy.random as nr @@ -47,7 +49,7 @@ if ek > be: be = ek bestb = b - print k, 'classes, free energy:', ek + print(k, 'classes, free energy:', ek) ############################################################################### # 3. plot the result @@ -69,7 +71,7 @@ bplugin = bgmm.BGMM(k, dim, cent, prec, w) bplugin.guess_priors(x) bfk = bplugin.bayes_factor(x, pz.astype(np.int), nperm=120) - print k, 'classes, evidence:', bfk + print(k, 'classes, evidence:', bfk) if bfk > bbf: bestk = k bbf = bfk diff --git a/examples/algorithms/clustering_comparisons.py b/examples/algorithms/clustering_comparisons.py index 74f759fa77..d9ac90f9c4 100755 --- a/examples/algorithms/clustering_comparisons.py +++ b/examples/algorithms/clustering_comparisons.py @@ -9,7 +9,9 @@ Author: Bertrand Thirion, 2009 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np import numpy.random as nr @@ -38,8 +40,8 @@ wlabel, J1 = F.ward(nbseeds) seeds, label, J2 = F.geodesic_kmeans(seeds, label=wlabel.copy(), eps=1.e-7) -print 'Inertia values for the 3 algorithms: ' -print 'Geodesic k-means: ', J0, 'Wards: ', J1, 'Wards + gkm: ', J2 +print('Inertia values for the 3 algorithms: ') +print('Geodesic k-means: ', J0, 'Wards: ', J1, 'Wards + gkm: ', J2) plt.figure(figsize=(8, 4)) plt.subplot(1, 3, 1) diff --git a/examples/algorithms/gaussian_mixture_models.py b/examples/algorithms/gaussian_mixture_models.py index 016aae0635..36750d3d20 100755 --- a/examples/algorithms/gaussian_mixture_models.py +++ b/examples/algorithms/gaussian_mixture_models.py @@ -10,7 +10,9 @@ Author : Bertrand Thirion, 2008-2009 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np diff --git a/examples/algorithms/ward_clustering.py b/examples/algorithms/ward_clustering.py index 4fe6b49bdd..67f35638ae 100755 --- a/examples/algorithms/ward_clustering.py +++ b/examples/algorithms/ward_clustering.py @@ -6,7 +6,9 @@ Requires matplotlib """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np from numpy.random import randn, rand @@ -75,5 +77,5 @@ plt.show() if verbose: - print 'List of sub trees' - print tree.list_of_subtrees() + print('List of sub trees') + print(tree.list_of_subtrees()) diff --git a/examples/compute_fmri_contrast.py b/examples/compute_fmri_contrast.py index 5dca478324..b694177587 100755 --- a/examples/compute_fmri_contrast.py +++ b/examples/compute_fmri_contrast.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility import sys @@ -38,7 +39,7 @@ # Optional argument - default value 1, 0, 0, 0 nargs = len(sys.argv) if nargs not in (1, 2, 5): - print USAGE + print(USAGE) exit(1) if nargs == 1: # default no-argument case cvect = [1, 0, 0, 0] @@ -48,12 +49,12 @@ elif nargs == 5: # contrast as sequence of strings args = [arg.replace(',', '') for arg in sys.argv[1:]] if len(args) != 4: - print USAGE + print(USAGE) exit(1) try: cvect = [float(arg) for arg in args] except ValueError: - print USAGE + print(USAGE) exit(1) # Input files diff --git a/examples/data_package/nipy-examplepkg/setup.py b/examples/data_package/nipy-examplepkg/setup.py index 334e91137a..6df7ccb53e 100755 --- a/examples/data_package/nipy-examplepkg/setup.py +++ b/examples/data_package/nipy-examplepkg/setup.py @@ -7,7 +7,10 @@ from distutils.core import setup -import ConfigParser +try: + import ConfigParser as cfg # Python 2 +except ImportError: + import configparser as cfg # Python 3 # The directory under --prefix, under which to store files OUTPUT_BASE = pjoin('share', 'nipy', 'nipy') @@ -22,7 +25,7 @@ files = [pjoin(dirpath, filename) for filename in filenames] DATA_FILES.append((pjoin(OUTPUT_BASE, dirpath), files)) -config = ConfigParser.SafeConfigParser() +config = cfg.SafeConfigParser() config.read(pjoin(PKG_BASE, 'config.ini')) setup( diff --git a/examples/fiac/fiac_example.py b/examples/fiac/fiac_example.py index 09ef36b14d..200de69fce 100644 --- a/examples/fiac/fiac_example.py +++ b/examples/fiac/fiac_example.py @@ -19,6 +19,7 @@ #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility # Stdlib from tempfile import NamedTemporaryFile @@ -488,7 +489,7 @@ def run_run_models(subject_nos=SUBJECTS, run_nos = RUNS): try: run_model(subj, run) except IOError: - print 'Skipping subject %d, run %d' % (subj, run) + print('Skipping subject %d, run %d' % (subj, run)) def run_fixed_models(subject_nos=SUBJECTS, designs=DESIGNS): @@ -498,7 +499,7 @@ def run_fixed_models(subject_nos=SUBJECTS, designs=DESIGNS): try: fixed_effects(subj, design) except IOError: - print 'Skipping subject %d, design %s' % (subj, design) + print('Skipping subject %d, design %s' % (subj, design)) def run_group_models(designs=DESIGNS, contrasts=CONTRASTS): diff --git a/examples/fiac/fiac_util.py b/examples/fiac/fiac_util.py index 0c63316d11..f6745b2a44 100644 --- a/examples/fiac/fiac_util.py +++ b/examples/fiac/fiac_util.py @@ -12,12 +12,17 @@ #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility + # Stdlib import os from os import makedirs, listdir from os.path import exists, abspath, isdir, join as pjoin, splitext import csv -from StringIO import StringIO +try: + from StringIO import StringIO # Python 2 +except ImportError: + from io import StringIO # Python 3 # Third party import numpy as np @@ -386,7 +391,7 @@ def compare_results(subj, run, other_root, mask_fname): this_fname = pjoin(dirpath, fname) other_fname = this_fname.replace(DATADIR, other_root) if not exists(other_fname): - print this_fname, 'present but ', other_fname, 'missing' + print(this_fname, 'present but ', other_fname, 'missing') continue this_arr = load_image(this_fname).get_data() other_arr = load_image(other_fname).get_data() @@ -394,7 +399,7 @@ def compare_results(subj, run, other_root, mask_fname): if not ok and froot in ('effect', 'sd', 't'): # Maybe a sign flip ok = np.allclose(this_arr[msk], -other_arr[msk]) if not ok: - print 'Difference between', this_fname, other_fname + print('Difference between', this_fname, other_fname) def compare_all(other_root, mask_fname): diff --git a/examples/fiac/view_contrasts_3d.py b/examples/fiac/view_contrasts_3d.py index 493cb693ca..cf0befe1fd 100755 --- a/examples/fiac/view_contrasts_3d.py +++ b/examples/fiac/view_contrasts_3d.py @@ -6,6 +6,7 @@ #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility import numpy as np @@ -68,6 +69,6 @@ def view_thresholdedT(design, contrast, threshold, inequality=np.greater): design = 'block' contrast = 'sentence_0' threshold = 0.3 - print 'Starting thresholded view with:' - print 'Design=',design,'contrast=',contrast,'threshold=',threshold + print('Starting thresholded view with:') + print('Design=', design, 'contrast=', contrast, 'threshold=', threshold) view_thresholdedT(design, contrast, threshold) diff --git a/examples/formula/multi_session_contrast.py b/examples/formula/multi_session_contrast.py index 88dc631687..bf91817851 100755 --- a/examples/formula/multi_session_contrast.py +++ b/examples/formula/multi_session_contrast.py @@ -3,6 +3,8 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """ Example of more than one run in the same model """ +from __future__ import print_function # Python 2/3 compatibility + import numpy as np from nipy.algorithms.statistics.api import Term, Formula, Factor @@ -97,7 +99,7 @@ preC = contrast.design(rec, return_float=True) # C is the matrix such that preC = X.dot(C.T) C = np.dot(np.linalg.pinv(X), preC) -print C +print(C) # We can also get this by passing the contrast into the design creation. X, c = f.design(rec, return_float=True, contrasts=dict(C=contrast)) @@ -105,5 +107,5 @@ # Show the names of the non-trivial elements of the contrast nonzero = np.nonzero(np.fabs(C) >= 1e-5)[0] -print (f.dtype.names[nonzero[0]], f.dtype.names[nonzero[1]]) -print ((run_1_coder * c11), (run_2_coder * c12)) +print((f.dtype.names[nonzero[0]], f.dtype.names[nonzero[1]])) +print(((run_1_coder * c11), (run_2_coder * c12))) diff --git a/examples/formula/simple_contrast.py b/examples/formula/simple_contrast.py index d290f2ca2d..acffb6acda 100755 --- a/examples/formula/simple_contrast.py +++ b/examples/formula/simple_contrast.py @@ -2,6 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ A simple contrast for an FMRI HRF model """ +from __future__ import print_function # Python 2/3 compatibility import numpy as np @@ -54,4 +55,4 @@ np.testing.assert_almost_equal(C, c['C']) # The contrast matrix (approx equal to c['C']) -print C +print(C) diff --git a/examples/interfaces/process_fiac.py b/examples/interfaces/process_fiac.py index 2a30db7f36..d6a646224c 100755 --- a/examples/interfaces/process_fiac.py +++ b/examples/interfaces/process_fiac.py @@ -7,8 +7,9 @@ from glob import glob import numpy as np -from nipy.interfaces.spm import spm_info, make_job, scans_for_fnames, \ - run_jobdef, fnames_presuffix, fname_presuffix, fltcols +from nipy.interfaces.spm import (spm_info, make_job, scans_for_fnames, + run_jobdef, fnames_presuffix, fname_presuffix, + fltcols) def get_data(data_path, subj_id): diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index b52fe31848..f1c2f8bdb4 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -10,7 +10,9 @@ Author : Bertrand Thirion, 2009-2011 """ #autoindent -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np import scipy.stats as st diff --git a/examples/labs/blob_extraction.py b/examples/labs/blob_extraction.py index 9a2b4f18b7..fdfd491903 100755 --- a/examples/labs/blob_extraction.py +++ b/examples/labs/blob_extraction.py @@ -9,7 +9,9 @@ Author : Bertrand Thirion, 2009--2012 """ #autoindent -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np diff --git a/examples/labs/demo_dmtx.py b/examples/labs/demo_dmtx.py index d8af8c1e16..1dfa9b6598 100755 --- a/examples/labs/demo_dmtx.py +++ b/examples/labs/demo_dmtx.py @@ -9,7 +9,9 @@ Author : Bertrand Thirion: 2009-2010 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np @@ -19,8 +21,8 @@ raise RuntimeError("This script needs the matplotlib library") from nipy.modalities.fmri.design_matrix import make_dmtx -from nipy.modalities.fmri.experimental_paradigm import \ - EventRelatedParadigm, BlockParadigm +from nipy.modalities.fmri.experimental_paradigm import (EventRelatedParadigm, + BlockParadigm) # frame times tr = 1.0 @@ -47,14 +49,14 @@ duration=duration) X2 = make_dmtx(frametimes, paradigm, drift_model='polynomial', - drift_order=3) + drift_order=3) # FIR model paradigm = EventRelatedParadigm(conditions, onsets) hrf_model = 'FIR' X3 = make_dmtx(frametimes, paradigm, hrf_model='fir', drift_model='polynomial', drift_order=3, - fir_delays=range(1, 6)) + fir_delays=np.arange(1, 6)) # plot the results fig = plt.figure(figsize=(10, 6)) diff --git a/examples/labs/example_glm.py b/examples/labs/example_glm.py index ed3470fbc2..a2521a0e5d 100755 --- a/examples/labs/example_glm.py +++ b/examples/labs/example_glm.py @@ -13,7 +13,9 @@ Author : Bertrand Thirion, 2010 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import os import os.path as op @@ -105,8 +107,8 @@ contrast_path = 'zmap.nii' save(contrast_image, contrast_path) -print ('Wrote the some of the results as images in directory %s' % - op.abspath(os.getcwd())) +print('Wrote the some of the results as images in directory %s' % + op.abspath(os.getcwd())) h, c = np.histogram(zvals, 100) diff --git a/examples/labs/glm_lowlevel.py b/examples/labs/glm_lowlevel.py index 8d594d4202..b664e9358d 100755 --- a/examples/labs/glm_lowlevel.py +++ b/examples/labs/glm_lowlevel.py @@ -7,7 +7,9 @@ of time. The voxelwise t statistics associated with the baseline coefficient are then computed. """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np @@ -44,6 +46,6 @@ # Perform a F test without keeping the F stat p = mod.contrast([[1, 0], [1, - 1]]).p_value() -print np.shape(y) -print np.shape(X) -print np.shape(z) +print(np.shape(y)) +print(np.shape(X)) +print(np.shape(z)) diff --git a/examples/labs/group_reproducibility_analysis.py b/examples/labs/group_reproducibility_analysis.py index 8cfb86d3a4..c4364dbf6d 100755 --- a/examples/labs/group_reproducibility_analysis.py +++ b/examples/labs/group_reproducibility_analysis.py @@ -9,7 +9,9 @@ Author: Bertrand Thirion, 2005-2009 """ -print __doc__ +from __future__ import print_function # Python 2/3 compatibility + +print(__doc__) import numpy as np diff --git a/examples/labs/hierarchical_rois.py b/examples/labs/hierarchical_rois.py index 2d8edd660a..ab3237e6b7 100755 --- a/examples/labs/hierarchical_rois.py +++ b/examples/labs/hierarchical_rois.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility + __doc__ = \ """ Example of a script that crates a 'hierarchical roi' structure from the blob @@ -10,7 +12,8 @@ Author: Bertrand Thirion, 2008-2009 """ -print __doc__ + +print(__doc__) import numpy as np diff --git a/examples/labs/histogram_fits.py b/examples/labs/histogram_fits.py index 42ad5949f4..f72321fe14 100755 --- a/examples/labs/histogram_fits.py +++ b/examples/labs/histogram_fits.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of a script that perfoms histogram analysis of an activation image, to estimate activation Z-score with various heuristics: @@ -14,7 +15,7 @@ Needs matplotlib """ # Author : Bertrand Thirion, Gael Varoquaux 2008-2009 -print __doc__ +print(__doc__) import numpy as np diff --git a/examples/labs/multi_subject_parcellation.py b/examples/labs/multi_subject_parcellation.py index 889b52a78d..b8a221168c 100755 --- a/examples/labs/multi_subject_parcellation.py +++ b/examples/labs/multi_subject_parcellation.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This script contains a quick demo on a multi-subject parcellation on a toy 2D example. @@ -9,7 +10,7 @@ Needs matplotlib """ -print __doc__ +print(__doc__) import numpy as np diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index f4f41f8b74..5e2c91ae3a 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -1,13 +1,14 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of a script that uses the BSA (Bayesian Structural Analysis) i.e. nipy.labs.spatial_models.bayesian_structural_analysis module. Author : Bertrand Thirion, 2008-2010 """ -print __doc__ +print(__doc__) #autoindent from os import mkdir, getcwd, path @@ -48,7 +49,7 @@ if not path.exists(write_dir): mkdir(write_dir) method = 'quick' -print 'method used:', method +print('method used:', method) # call the function AF, BF = make_bsa_image(mask_images, betas, theta, dmax, ths, thq, smin, @@ -57,8 +58,8 @@ # Write the result. OK, this is only a temporary solution picname = path.join(write_dir, "AF_%04d.pic" % nbeta) -pickle.dump(AF, open(picname, 'w'), 2) +pickle.dump(AF, open(picname, 'wb'), 2) picname = path.join(write_dir, "BF_%04d.pic" % nbeta) -pickle.dump(BF, open(picname, 'w'), 2) +pickle.dump(BF, open(picname, 'wb'), 2) -print "Wrote all the results in directory %s" % write_dir +print("Wrote all the results in directory %s" % write_dir) diff --git a/examples/labs/need_data/demo_blob_from_image.py b/examples/labs/need_data/demo_blob_from_image.py index 46d39b21ac..8bba1ab8f8 100755 --- a/examples/labs/need_data/demo_blob_from_image.py +++ b/examples/labs/need_data/demo_blob_from_image.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This script generates a noisy activation image and extracts the blob from it. @@ -72,7 +73,7 @@ wim = lroi.to_image('id', roi=True, descrip=descrip) save(wim, path.join(write_dir, "leaves.nii")) -print "Wrote the blob image in %s" % path.join(write_dir, "blob.nii") -print "Wrote the blob-average signal image in %s" % path.join(write_dir, - "bmap.nii") -print "Wrote the end-blob image in %s" % path.join(write_dir, "leaves.nii") +print("Wrote the blob image in %s" % path.join(write_dir, "blob.nii")) +print("Wrote the blob-average signal image in %s" + % path.join(write_dir, "bmap.nii")) +print("Wrote the end-blob image in %s" % path.join(write_dir, "leaves.nii")) diff --git a/examples/labs/need_data/demo_roi.py b/examples/labs/need_data/demo_roi.py index c6fe7009bf..bb34843753 100755 --- a/examples/labs/need_data/demo_roi.py +++ b/examples/labs/need_data/demo_roi.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This is a little demo that simply shows ROI manipulation within the nipy framework. @@ -9,7 +10,7 @@ Author: Bertrand Thirion, 2009-2010 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -52,7 +53,7 @@ roi_domain = domain.mask(roi.label > -1) dom_img = roi_domain.to_image() save(dom_img, path.join(write_dir, "myroi.nii")) -print 'Wrote an ROI mask image in %s' % path.join(write_dir, "myroi.nii") +print('Wrote an ROI mask image in %s' % path.join(write_dir, "myroi.nii")) # ---------------------------------------------------- # ---- example 2: create ROIs from a blob image ------ @@ -111,7 +112,7 @@ roi_path_5 = path.join(write_dir, "roi_some_blobs.nii") save(wim5, roi_path_5) -print "Wrote ROI mask images in %s, \n %s \n %s \n and %s" %\ - (roi_path_2, roi_path_3, roi_path_4, roi_path_5) +print("Wrote ROI mask images in %s, \n %s \n %s \n and %s" % + (roi_path_2, roi_path_3, roi_path_4, roi_path_5)) plt.show() diff --git a/examples/labs/need_data/demo_ward_clustering.py b/examples/labs/need_data/demo_ward_clustering.py index ff7609127a..77703765e4 100755 --- a/examples/labs/need_data/demo_ward_clustering.py +++ b/examples/labs/need_data/demo_ward_clustering.py @@ -1,12 +1,13 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This shows the effect of ward clustering on a real fMRI dataset Author: Bertrand Thirion, 2010 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -30,7 +31,6 @@ if not path.exists(write_dir): mkdir(write_dir) - # read the data mask = load(mask_image).get_data() > 0 ijk = np.array(np.where(mask)).T @@ -46,4 +46,4 @@ wdata = mask - 1 wdata[mask] = u save(Nifti1Image(wdata, load(mask_image).get_affine()), label_image) -print "Label image written in %s" % label_image +print("Label image written in %s" % label_image) diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index 45eb1ff561..e06fb56504 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This is an example where: @@ -16,7 +17,7 @@ Author : Bertrand Thirion, 2010 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -197,12 +198,12 @@ plt.subplot(1, my_roi.k, k + 1) # get the confidence intervals for the effects and plot them -condition 0 - conf_int = res.conf_int(cols=range(fir_order)).squeeze() + conf_int = res.conf_int(cols=np.arange(fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 plt.errorbar(np.arange(fir_order), conf_int.mean(1), yerr=yerr) # get the confidence intervals for the effects and plot them -condition 1 - conf_int = res.conf_int(cols=range(fir_order, 2 * fir_order)).squeeze() + conf_int = res.conf_int(cols=np.arange(fir_order, 2 * fir_order)).squeeze() yerr = (conf_int[:, 1] - conf_int[:, 0]) / 2 plt.errorbar(np.arange(fir_order), conf_int.mean(1), yerr=yerr) plt.legend(('condition c0', 'condition c1')) diff --git a/examples/labs/need_data/first_level_fiac.py b/examples/labs/need_data/first_level_fiac.py index a929097cb5..d4c3a3f4d7 100755 --- a/examples/labs/need_data/first_level_fiac.py +++ b/examples/labs/need_data/first_level_fiac.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Script that performs a first-level analysis of the FIAC dataset. @@ -81,11 +82,11 @@ def length_p_vector(con, p): if not path.exists(write_dir): mkdir(write_dir) -print 'Computing contrasts...' +print('Computing contrasts...') mean_map = multi_session_model.means[0] # for display for index, (contrast_id, contrast_val) in enumerate(contrasts.items()): - print ' Contrast % 2i out of %i: %s' % ( - index + 1, len(contrasts), contrast_id) + print(' Contrast % 2i out of %i: %s' % ( + index + 1, len(contrasts), contrast_id)) z_image_path = path.join(write_dir, '%s_z_map.nii' % contrast_id) z_map, = multi_session_model.contrast( [contrast_val] * 2, con_id=contrast_id, output_z=True) @@ -105,5 +106,5 @@ def length_p_vector(con, p): black_bg=True) plt.savefig(path.join(write_dir, '%s_z_map.png' % contrast_id)) -print "All the results were witten in %s" % write_dir +print("All the results were witten in %s" % write_dir) plt.show() diff --git a/examples/labs/need_data/get_data_light.py b/examples/labs/need_data/get_data_light.py index 2512f22d69..c20bcb82f8 100755 --- a/examples/labs/need_data/get_data_light.py +++ b/examples/labs/need_data/get_data_light.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Get two images from the web (one mask image and one spmT image) and put them in the nipy user dir - usually therefore at ``~/.nipy/tests/data``. @@ -9,7 +10,10 @@ """ import os -import urllib2 +try: + from urllib2 import urlopen # Python 2 +except ImportError: + from urllib.request import urlopen # Python 3 import tarfile from nibabel.data import get_nipy_user_dir @@ -36,8 +40,8 @@ def get_second_level_dataset(): if not os.path.exists(mask_image): filename = 'mask.nii.gz' datafile = os.path.join(url, filename) - fp = urllib2.urlopen(datafile) - local_file = open(mask_image, 'w') + fp = urlopen(datafile) + local_file = open(mask_image, 'wb') local_file.write(fp.read()) local_file.flush() local_file.close() @@ -46,8 +50,8 @@ def get_second_level_dataset(): if not os.path.exists(input_image): filename = 'spmT_0029.nii.gz' datafile = os.path.join(url, filename) - fp = urllib2.urlopen(datafile) - local_file = open(input_image, 'w') + fp = urlopen(datafile) + local_file = open(input_image, 'wb') local_file.write(fp.read()) local_file.flush() local_file.close() @@ -56,8 +60,8 @@ def get_second_level_dataset(): if not os.path.exists(group_data): filename = 'group_t_images.tar.gz' datafile = os.path.join(url, filename) - fp = urllib2.urlopen(datafile) - local_file = open(group_data, 'w') + fp = urlopen(datafile) + local_file = open(group_data, 'wb') local_file.write(fp.read()) local_file.flush() local_file.close() @@ -85,21 +89,21 @@ def get_first_level_dataset(): # download mask_image if necessary if not os.path.exists(paradigm): - print 'Downloading mask image, this may take time' + print('Downloading mask image, this may take time') datafile = os.path.join(url, 'localizer_paradigm.csv') - fp = urllib2.urlopen(datafile) - local_file = open(paradigm, 'w') + fp = urlopen(datafile) + local_file = open(paradigm, 'wb') local_file.write(fp.read()) local_file.flush() local_file.close() # download raw_fmri if necessary if not os.path.exists(raw_fmri): - print 'Downloading fmri image, this may take time' + print('Downloading fmri image, this may take time') filename = 's12069_swaloc1_corr.nii.gz' datafile = os.path.join(url, filename) - fp = urllib2.urlopen(datafile) - local_file = open(raw_fmri, 'w') + fp = urlopen(datafile) + local_file = open(raw_fmri, 'wb') local_file.write(fp.read()) local_file.flush() local_file.close() diff --git a/examples/labs/need_data/group_reproducibility_analysis.py b/examples/labs/need_data/group_reproducibility_analysis.py index f55afb6081..a688bc23da 100755 --- a/examples/labs/need_data/group_reproducibility_analysis.py +++ b/examples/labs/need_data/group_reproducibility_analysis.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of script to analyse the reproducibility in group studies using a bootstrap procedure. @@ -24,20 +25,19 @@ except ImportError: raise RuntimeError("This script needs the matplotlib library") -from nipy.labs.utils.reproducibility_measures import \ - group_reproducibility_metrics, map_reproducibility +from nipy.labs.utils.reproducibility_measures import ( + group_reproducibility_metrics) # Local import from get_data_light import DATA_DIR, get_second_level_dataset -print 'This analysis takes a long while, please be patient' +print('This analysis takes a long while, please be patient') ############################################################################## # Set the paths, data, etc. ############################################################################## nsubj = 12 -subj_id = range(nsubj) nbeta = 29 data_dir = path.join(DATA_DIR, 'group_t_images') diff --git a/examples/labs/need_data/histogram_fits.py b/examples/labs/need_data/histogram_fits.py index 7061f28223..ce5ca8b03a 100755 --- a/examples/labs/need_data/histogram_fits.py +++ b/examples/labs/need_data/histogram_fits.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of a script that perfoms histogram analysis of an activation image. This is based on a real fMRI image. diff --git a/examples/labs/need_data/localizer_glm_ar.py b/examples/labs/need_data/localizer_glm_ar.py index 71af8eae10..279b63fdef 100755 --- a/examples/labs/need_data/localizer_glm_ar.py +++ b/examples/labs/need_data/localizer_glm_ar.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Full step-by-step example of fitting a GLM to experimental data and visualizing the results. @@ -19,7 +20,7 @@ Author : Bertrand Thirion, 2010--2012 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -68,15 +69,15 @@ if not path.exists(write_dir): mkdir(write_dir) -print 'Computation will be performed in directory: %s' % write_dir +print('Computation will be performed in directory: %s' % write_dir) ######################################## # Design matrix ######################################## -print 'Loading design matrix...' +print('Loading design matrix...') -paradigm = load_paradigm_from_csv_file(paradigm_file).values()[0] +paradigm = list(load_paradigm_from_csv_file(paradigm_file).values())[0] design_matrix = make_dmtx(frametimes, paradigm, hrf_model=hrf_model, drift_model=drift_model, hfcut=hfcut) @@ -122,7 +123,7 @@ # Perform a GLM analysis ######################################## -print 'Fitting a GLM (this takes time)...' +print('Fitting a GLM (this takes time)...') fmri_glm = FMRILinearModel(data_path, design_matrix.matrix, mask='compute') fmri_glm.fit(do_scaling=True, model='ar1') @@ -131,10 +132,10 @@ # Estimate the contrasts ######################################### -print 'Computing contrasts...' +print('Computing contrasts...') for index, (contrast_id, contrast_val) in enumerate(contrasts.iteritems()): - print ' Contrast % 2i out of %i: %s' % ( - index + 1, len(contrasts), contrast_id) + print(' Contrast % 2i out of %i: %s' % + (index + 1, len(contrasts), contrast_id)) # save the z_image image_path = path.join(write_dir, '%s_z_map.nii' % contrast_id) z_map, = fmri_glm.contrast(contrast_val, con_id=contrast_id, output_z=True) @@ -153,6 +154,6 @@ threshold=2.5) plt.savefig(path.join(write_dir, '%s_z_map.png' % contrast_id)) -print "All the results were witten in %s" % write_dir +print("All the results were witten in %s" % write_dir) plt.show() diff --git a/examples/labs/need_data/parcel_intra.py b/examples/labs/need_data/parcel_intra.py index 9c8983b2d2..eb77f95b02 100755 --- a/examples/labs/need_data/parcel_intra.py +++ b/examples/labs/need_data/parcel_intra.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of script to parcellate the data from one subject, using various algorithms. @@ -9,7 +10,7 @@ author: Bertrand Thirion, 2005-2009 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path diff --git a/examples/labs/need_data/parcel_multisubj.py b/examples/labs/need_data/parcel_multisubj.py index e3ebf7ddd0..c304554fee 100755 --- a/examples/labs/need_data/parcel_multisubj.py +++ b/examples/labs/need_data/parcel_multisubj.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of script to parcellate mutli-subject data. @@ -65,4 +66,4 @@ # compute and write the parcel-based statistics rfx_path = path.join(write_dir, 'prfx_%s.nii' % nbeta) parcellation_based_analysis(fpa, test_images, 'one_sample', rfx_path=rfx_path) -print "Wrote everything in %s" % write_dir +print("Wrote everything in %s" % write_dir) diff --git a/examples/labs/need_data/permutation_test.py b/examples/labs/need_data/permutation_test.py index 4ebdf3bb75..743208e2a4 100755 --- a/examples/labs/need_data/permutation_test.py +++ b/examples/labs/need_data/permutation_test.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of onesample permutation test Needs *example data* package @@ -25,7 +26,7 @@ # Cluster definition: (threshold, diameter) # Note that a list of definitions can be passed to ptest.calibrate cluster_def = (ptest.height_threshold(0.01), None) -print cluster_def +print(cluster_def) # Multiple calibration # To get accurate pvalues, don't pass nperms (default is 1e4) diff --git a/examples/labs/need_data/plot_registration.py b/examples/labs/need_data/plot_registration.py index 9646369650..84e1f1c86c 100755 --- a/examples/labs/need_data/plot_registration.py +++ b/examples/labs/need_data/plot_registration.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of plotting a registration checker with nipy.labs vizualization tools @@ -11,7 +12,7 @@ Needs matplotlib. """ -print __doc__ +print(__doc__) try: import matplotlib.pyplot as plt diff --git a/examples/labs/need_data/viz.py b/examples/labs/need_data/viz.py index c6147a1562..77c48ca9ba 100755 --- a/examples/labs/need_data/viz.py +++ b/examples/labs/need_data/viz.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Example of activation image vizualization with nipy.labs vizualization tools @@ -8,7 +9,7 @@ Needs matplotlib """ -print __doc__ +print(__doc__) import os.path @@ -43,9 +44,9 @@ 'nobias_anubis.nii.gz')) anat = anat_img.get_data() anat_affine = anat_img.get_affine() -except OSError, e: +except OSError as e: # File does not exist: the data package is not installed - print e + print(e) anat = None anat_affine = None diff --git a/examples/labs/permutation_test_fakedata.py b/examples/labs/permutation_test_fakedata.py index 82c519cdf3..30ea493c21 100755 --- a/examples/labs/permutation_test_fakedata.py +++ b/examples/labs/permutation_test_fakedata.py @@ -2,6 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: """ Example script for group permutation testing """ +from __future__ import print_function # Python 2/3 compatibility import numpy as np @@ -84,11 +85,11 @@ def make_data(n=10, mask_shape=(10, 10, 10), axis=0, r=3, signal=5): J = np.where(1 - (results["size_Corr_p_values"] > level) * (results["Fisher_Corr_p_values"] > level) * (Tmax_P > level))[0] - print "\nDETECTED CLUSTERS STATISTICS:\n" - print "Cluster detection threshold:", round(results["thresh"], 2) + print("\nDETECTED CLUSTERS STATISTICS:\n") + print("Cluster detection threshold:", round(results["thresh"], 2)) if results["diam"] != None: - print "minimum cluster diameter", results["diam"] - print "Cluster level FWER controled at", level + print("minimum cluster diameter", results["diam"]) + print("Cluster level FWER controled at", level) for j in J: X, Y, Z = results["peak_XYZ"][:, j] strXYZ = str(X).zfill(2) + " " + str(Y).zfill(2) + " " + \ diff --git a/examples/labs/two_sample_mixed_effects.py b/examples/labs/two_sample_mixed_effects.py index d747573c76..b06c0be07e 100755 --- a/examples/labs/two_sample_mixed_effects.py +++ b/examples/labs/two_sample_mixed_effects.py @@ -1,12 +1,13 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Demo two sample mixed effect models Needs matplotlib """ -print __doc__ +print(__doc__) import numpy as np @@ -28,7 +29,7 @@ nperms = twosample.count_permutations(n1, n2) -magics = np.asarray(range(nperms)) +magics = np.arange(nperms) t = twosample.stat_mfx(y1, v1, y2, v2, id='student_mfx', Magics=magics) diff --git a/examples/labs/watershed_labeling.py b/examples/labs/watershed_labeling.py index 03bd98dd85..92fb53c874 100755 --- a/examples/labs/watershed_labeling.py +++ b/examples/labs/watershed_labeling.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ This scipt generates a noisy activation image image and performs a watershed segmentation in it. @@ -10,7 +11,7 @@ Author : Bertrand Thirion, 2009--2012 """ #autoindent -print __doc__ +print(__doc__) import numpy as np diff --git a/examples/labs/write_paradigm_file.py b/examples/labs/write_paradigm_file.py index aa1289a224..d4608ed2cb 100755 --- a/examples/labs/write_paradigm_file.py +++ b/examples/labs/write_paradigm_file.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function # Python 2/3 compatibility """ Examples of a paradigm .csv file generation: the neurospin/localizer paradigm. @@ -44,10 +45,10 @@ sess = np.zeros(np.size(time)).astype('int8') pdata = np.vstack((sess, cid, time)).T csvfile = 'localizer_paradigm.csv' -fid = open(csvfile, "wb") +fid = open(csvfile, "wt") writer = csv.writer(fid, delimiter=' ') for row in pdata: writer.writerow(row) fid.close() -print "Created the paradigm file in %s " % csvfile +print("Created the paradigm file in %s " % csvfile) diff --git a/examples/space_time_realign.py b/examples/space_time_realign.py index 9753850ba6..639faf3452 100755 --- a/examples/space_time_realign.py +++ b/examples/space_time_realign.py @@ -17,6 +17,8 @@ Author: Alexis Roche, 2009. """ +from __future__ import print_function # Python 2/3 compatibility + import os from os.path import split as psplit, abspath @@ -32,7 +34,7 @@ # Declare interleaved ascending slice order nslices = runs[0].shape[2] -slice_order = range(0, nslices, 2) + range(1, nslices, 2) +slice_order = list(range(0, nslices, 2)) + list(range(1, nslices, 2)) print('Slice order: %s' % slice_order) # Spatio-temporal realigner diff --git a/examples/tissue_classification.py b/examples/tissue_classification.py index 1513fd965a..099aa5cb42 100755 --- a/examples/tissue_classification.py +++ b/examples/tissue_classification.py @@ -3,6 +3,8 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """ Script example of tissue classification """ +from __future__ import print_function # Python 2/3 compatibility + import numpy as np from nipy import load_image, save_image From ad26583d956b044233945a0707ee963658d304f6 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 15 Sep 2012 14:03:15 +0100 Subject: [PATCH 032/164] BF: make integer division explicit for python 3 Implicit integer division in finding colors in colormap. --- nipy/algorithms/clustering/gmm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/algorithms/clustering/gmm.py b/nipy/algorithms/clustering/gmm.py index 2a31c1a963..cfb28994db 100644 --- a/nipy/algorithms/clustering/gmm.py +++ b/nipy/algorithms/clustering/gmm.py @@ -217,7 +217,7 @@ def plot2D(x, my_gmm, z=None, with_dots=True, log_scale=False, mpaxes=None, plt.plot(x[:, 0], x[:, 1], 'o') else: hsv = plt.cm.hsv(range(256)) - col = hsv[range(0, 256, 256 / int(z.max() + 1))] + col = hsv[range(0, 256, 256 // int(z.max() + 1))] for k in range(z.max() + 1): plt.plot(x[z == k, 0], x[z == k, 1], 'o', color=col[k]) From b4d8aea8423bbeefb66a1f3db94acc70aef01522 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 15 Sep 2012 14:15:59 +0100 Subject: [PATCH 033/164] BF: work round change in round() for python 3 round now calls to a ``__round__`` method, which is missing for numpy arrays. --- nipy/labs/viz_tools/slicers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/labs/viz_tools/slicers.py b/nipy/labs/viz_tools/slicers.py index 972254fbf2..b6459c6fb3 100644 --- a/nipy/labs/viz_tools/slicers.py +++ b/nipy/labs/viz_tools/slicers.py @@ -98,7 +98,7 @@ def do_cut(self, map, affine): """ coords = [0, 0, 0] coords['xyz'.index(self.direction)] = self.coord - x_map, y_map, z_map = [int(round(c)) for c in + x_map, y_map, z_map = [int(np.round(c)) for c in coord_transform(coords[0], coords[1], coords[2], From d57f51052115bb10e2fc253e24bcbbfb35a1088e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 17 Sep 2012 12:30:34 +0100 Subject: [PATCH 034/164] DOC: examples runner script in release checklist Add examples runner to tasks to do before release. --- doc/devel/guidelines/make_release.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index 1ea729fe6a..c37e266a05 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -57,6 +57,16 @@ Release checklist * Use the opportunity to update the ``.mailmap`` file if there are any duplicate authors listed from ``git shortlog``. +* Check the examples in python 2 and python 3, by running something like:: + + cd .. + ./nipy/tools/run_log_examples.py nipy/examples --log-path=~/tmp/eg_logs + + in a python 2 and python 3 virtualenv. Review the output in (e.g.) + ``~/tmp/eg_logs``. The output file ``summary.txt`` will have the pass file + printout that the ``run_log_examples.py`` script puts onto stdout while + running. + * Check the ``long_description`` in ``nipy/info.py``. Check it matches the ``README`` in the root directory. From ad94aed1d11cdc8d895461dd780508633fa9b9b9 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 11 Oct 2012 16:11:43 +0100 Subject: [PATCH 035/164] FOX: explicitly set __doc__ for printing print function detects implicit module ``__doc__`` as None; set ``__doc__`` explicitly where printed. --- examples/algorithms/bayesian_gaussian_mixtures.py | 5 ++--- examples/algorithms/clustering_comparisons.py | 5 ++--- examples/algorithms/gaussian_mixture_models.py | 5 ++--- examples/algorithms/ward_clustering.py | 5 ++--- examples/labs/bayesian_structural_analysis.py | 6 ++---- examples/labs/blob_extraction.py | 6 ++---- examples/labs/demo_dmtx.py | 5 ++--- examples/labs/example_glm.py | 5 ++--- examples/labs/glm_lowlevel.py | 5 ++--- examples/labs/group_reproducibility_analysis.py | 5 ++--- examples/labs/hierarchical_rois.py | 2 -- examples/labs/histogram_fits.py | 2 +- examples/labs/multi_subject_parcellation.py | 2 +- examples/labs/need_data/bayesian_structural_analysis.py | 2 +- examples/labs/need_data/demo_roi.py | 2 +- examples/labs/need_data/demo_ward_clustering.py | 2 +- examples/labs/need_data/example_roi_and_glm.py | 2 +- examples/labs/need_data/localizer_glm_ar.py | 2 +- examples/labs/need_data/parcel_intra.py | 2 +- examples/labs/need_data/plot_registration.py | 2 +- examples/labs/need_data/viz.py | 2 +- examples/labs/two_sample_mixed_effects.py | 2 +- examples/labs/watershed_labeling.py | 2 +- 23 files changed, 32 insertions(+), 46 deletions(-) diff --git a/examples/algorithms/bayesian_gaussian_mixtures.py b/examples/algorithms/bayesian_gaussian_mixtures.py index 17e647b19e..c93fbc1039 100755 --- a/examples/algorithms/bayesian_gaussian_mixtures.py +++ b/examples/algorithms/bayesian_gaussian_mixtures.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Example of a demo that fits a Bayesian Gaussian Mixture Model (GMM) to a dataset. @@ -12,8 +13,6 @@ Author : Bertrand Thirion, 2008-2010 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/algorithms/clustering_comparisons.py b/examples/algorithms/clustering_comparisons.py index d9ac90f9c4..30383c3795 100755 --- a/examples/algorithms/clustering_comparisons.py +++ b/examples/algorithms/clustering_comparisons.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Simple demo that partitions a smooth field into 10 clusters. In most cases, Ward's clustering behaves best. @@ -9,8 +10,6 @@ Author: Bertrand Thirion, 2009 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/algorithms/gaussian_mixture_models.py b/examples/algorithms/gaussian_mixture_models.py index 36750d3d20..92720ebccc 100755 --- a/examples/algorithms/gaussian_mixture_models.py +++ b/examples/algorithms/gaussian_mixture_models.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Example of a demo that fits a Gaussian Mixture Model (GMM) to a dataset The possible number of clusters is in the [1,10] range The proposed algorithm correctly selects a solution with 2 or 3 classes @@ -10,8 +11,6 @@ Author : Bertrand Thirion, 2008-2009 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/algorithms/ward_clustering.py b/examples/algorithms/ward_clustering.py index 67f35638ae..7cb2c2c68c 100755 --- a/examples/algorithms/ward_clustering.py +++ b/examples/algorithms/ward_clustering.py @@ -1,13 +1,12 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Demo ward clustering on a graph: various ways of forming clusters and dendrogram Requires matplotlib """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index f1c2f8bdb4..99e9e4c568 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ This script generates a noisy multi-subject activation image dataset and applies the Bayesian structural analysis on it @@ -9,9 +10,6 @@ Author : Bertrand Thirion, 2009-2011 """ -#autoindent -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/blob_extraction.py b/examples/labs/blob_extraction.py index fdfd491903..5709b0ff6e 100755 --- a/examples/labs/blob_extraction.py +++ b/examples/labs/blob_extraction.py @@ -1,16 +1,14 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ This scipt makes a noisy activation image and extracts the blobs from it. Requires matplotlib Author : Bertrand Thirion, 2009--2012 """ -#autoindent -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/demo_dmtx.py b/examples/labs/demo_dmtx.py index 1dfa9b6598..37fbd663ed 100755 --- a/examples/labs/demo_dmtx.py +++ b/examples/labs/demo_dmtx.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Examples of design matrices specification and and computation (event-related design, FIR design, etc) @@ -9,8 +10,6 @@ Author : Bertrand Thirion: 2009-2010 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/example_glm.py b/examples/labs/example_glm.py index a2521a0e5d..2a58f17986 100755 --- a/examples/labs/example_glm.py +++ b/examples/labs/example_glm.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ This is an example where: 1. An sequence of fMRI volumes are simulated @@ -13,8 +14,6 @@ Author : Bertrand Thirion, 2010 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import os diff --git a/examples/labs/glm_lowlevel.py b/examples/labs/glm_lowlevel.py index b664e9358d..17b85d539c 100755 --- a/examples/labs/glm_lowlevel.py +++ b/examples/labs/glm_lowlevel.py @@ -1,14 +1,13 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ This example simulates a number of pure Gaussian white noise signals, then fits each one in terms of two regressors: a constant baseline, and a linear function of time. The voxelwise t statistics associated with the baseline coefficient are then computed. """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/group_reproducibility_analysis.py b/examples/labs/group_reproducibility_analysis.py index c4364dbf6d..9a919e5203 100755 --- a/examples/labs/group_reproducibility_analysis.py +++ b/examples/labs/group_reproducibility_analysis.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ Example of script to analyse the reproducibility in group studies using a bootstrap procedure @@ -9,8 +10,6 @@ Author: Bertrand Thirion, 2005-2009 """ -from __future__ import print_function # Python 2/3 compatibility - print(__doc__) import numpy as np diff --git a/examples/labs/hierarchical_rois.py b/examples/labs/hierarchical_rois.py index ab3237e6b7..bee9c3a119 100755 --- a/examples/labs/hierarchical_rois.py +++ b/examples/labs/hierarchical_rois.py @@ -2,7 +2,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility - __doc__ = \ """ Example of a script that crates a 'hierarchical roi' structure from the blob @@ -12,7 +11,6 @@ Author: Bertrand Thirion, 2008-2009 """ - print(__doc__) import numpy as np diff --git a/examples/labs/histogram_fits.py b/examples/labs/histogram_fits.py index f72321fe14..b0b12c815c 100755 --- a/examples/labs/histogram_fits.py +++ b/examples/labs/histogram_fits.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Example of a script that perfoms histogram analysis of an activation image, to estimate activation Z-score with various heuristics: diff --git a/examples/labs/multi_subject_parcellation.py b/examples/labs/multi_subject_parcellation.py index b8a221168c..335c0f9949 100755 --- a/examples/labs/multi_subject_parcellation.py +++ b/examples/labs/multi_subject_parcellation.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ This script contains a quick demo on a multi-subject parcellation on a toy 2D example. diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index 5e2c91ae3a..1eef9997d7 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Example of a script that uses the BSA (Bayesian Structural Analysis) i.e. nipy.labs.spatial_models.bayesian_structural_analysis module. diff --git a/examples/labs/need_data/demo_roi.py b/examples/labs/need_data/demo_roi.py index bb34843753..a4238d034b 100755 --- a/examples/labs/need_data/demo_roi.py +++ b/examples/labs/need_data/demo_roi.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ This is a little demo that simply shows ROI manipulation within the nipy framework. diff --git a/examples/labs/need_data/demo_ward_clustering.py b/examples/labs/need_data/demo_ward_clustering.py index 77703765e4..7a09dfe3e1 100755 --- a/examples/labs/need_data/demo_ward_clustering.py +++ b/examples/labs/need_data/demo_ward_clustering.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ This shows the effect of ward clustering on a real fMRI dataset Author: Bertrand Thirion, 2010 diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index e06fb56504..36bb94aa01 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ This is an example where: 1. A sequence of fMRI volumes are loaded diff --git a/examples/labs/need_data/localizer_glm_ar.py b/examples/labs/need_data/localizer_glm_ar.py index 279b63fdef..5ffd0a6933 100755 --- a/examples/labs/need_data/localizer_glm_ar.py +++ b/examples/labs/need_data/localizer_glm_ar.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Full step-by-step example of fitting a GLM to experimental data and visualizing the results. diff --git a/examples/labs/need_data/parcel_intra.py b/examples/labs/need_data/parcel_intra.py index eb77f95b02..71f1da0f08 100755 --- a/examples/labs/need_data/parcel_intra.py +++ b/examples/labs/need_data/parcel_intra.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Example of script to parcellate the data from one subject, using various algorithms. diff --git a/examples/labs/need_data/plot_registration.py b/examples/labs/need_data/plot_registration.py index 84e1f1c86c..a0b0928b30 100755 --- a/examples/labs/need_data/plot_registration.py +++ b/examples/labs/need_data/plot_registration.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Example of plotting a registration checker with nipy.labs vizualization tools The idea is to represent the anatomical image to be checked with an overlay of diff --git a/examples/labs/need_data/viz.py b/examples/labs/need_data/viz.py index 77c48ca9ba..c5cfdbf76f 100755 --- a/examples/labs/need_data/viz.py +++ b/examples/labs/need_data/viz.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Example of activation image vizualization with nipy.labs vizualization tools Needs *example data* package. diff --git a/examples/labs/two_sample_mixed_effects.py b/examples/labs/two_sample_mixed_effects.py index b06c0be07e..c50de0eb1b 100755 --- a/examples/labs/two_sample_mixed_effects.py +++ b/examples/labs/two_sample_mixed_effects.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ Demo two sample mixed effect models Needs matplotlib diff --git a/examples/labs/watershed_labeling.py b/examples/labs/watershed_labeling.py index 92fb53c874..77da5929a8 100755 --- a/examples/labs/watershed_labeling.py +++ b/examples/labs/watershed_labeling.py @@ -2,7 +2,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility -""" +__doc__ = """ This scipt generates a noisy activation image image and performs a watershed segmentation in it. From 32d028c1159355a134c4c783b77b7581e3b4d0b6 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 11 Oct 2012 18:11:49 +0100 Subject: [PATCH 036/164] FIX: remove use of xrange from example This allows the example to run in Python 3 --- examples/labs/permutation_test_fakedata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/labs/permutation_test_fakedata.py b/examples/labs/permutation_test_fakedata.py index 30ea493c21..3969886822 100755 --- a/examples/labs/permutation_test_fakedata.py +++ b/examples/labs/permutation_test_fakedata.py @@ -77,7 +77,7 @@ def make_data(n=10, mask_shape=(10, 10, 10), axis=0, r=3, signal=5): Tmax = np.zeros(nclust, float) Tmax_P = np.zeros(nclust, float) Diam = np.zeros(nclust, int) - for j in xrange(nclust): + for j in range(nclust): I = np.where(results["labels"]==j)[0] Tmax[j] = P.Tvalues[I].max() Tmax_P[j] = voxel_results["Corr_p_values"][I].min() From d1765b068c8d63b2496ede6d5168b7c92919fd4f Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 11 Oct 2012 18:32:05 +0100 Subject: [PATCH 037/164] FIX: update glm beta variance example for Py3 Future imports and print_function --- examples/labs/need_data/glm_beta_and_variance.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/labs/need_data/glm_beta_and_variance.py b/examples/labs/need_data/glm_beta_and_variance.py index 65605042cb..6f466f2a0e 100644 --- a/examples/labs/need_data/glm_beta_and_variance.py +++ b/examples/labs/need_data/glm_beta_and_variance.py @@ -1,6 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import print_function +__doc__ = \ """ This example shows how to get variance and beta estimated from a nipy GLM. @@ -16,7 +18,7 @@ Author : Bertrand Thirion, 2010--2012 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -65,16 +67,16 @@ if not path.exists(write_dir): mkdir(write_dir) -print 'Computation will be performed in directory: %s' % write_dir +print('Computation will be performed in directory: %s' % write_dir) ######################################## # Design matrix ######################################## -print 'Loading design matrix...' +print('Loading design matrix...') # the example example.labs.write_paradigm_file shows how to create this file -paradigm = load_paradigm_from_csv_file(paradigm_file).values()[0] +paradigm = list(load_paradigm_from_csv_file(paradigm_file).values())[0] design_matrix = make_dmtx(frametimes, paradigm, hrf_model=hrf_model, drift_model=drift_model, hfcut=hfcut) @@ -90,7 +92,7 @@ # Perform a GLM analysis ######################################## -print 'Fitting a GLM (this takes time)...' +print('Fitting a GLM (this takes time)...') fmri_glm = FMRILinearModel(data_path, design_matrix.matrix, mask='compute') fmri_glm.fit(do_scaling=True, model='ar1') @@ -109,14 +111,14 @@ beta_image.get_header()['descrip'] = ( 'Parameter estimates of the localizer dataset') save(beta_image, path.join(write_dir, 'beta.nii')) -print "Beta image witten in %s" % write_dir +print("Beta image witten in %s" % write_dir) variance_map = mask.astype(np.float) variance_map[mask] = variance_hat # Create a snapshots of the variance image contrasts vmax = np.log(variance_hat.max()) -plot_map(np.log(variance_map + .1), +plot_map(np.log(variance_map + .1), fmri_glm.affine, cmap=cm.hot_black_bone, vmin=np.log(0.1), From 4fafecc38330dc6620154caea491222f7e2d9ec8 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 11 Oct 2012 18:54:56 +0100 Subject: [PATCH 038/164] FIX: further __doc__ and print updates Adding print_function and explicit defines of ``__doc__`` --- examples/labs/need_data/one_sample_t_test.py | 7 +++--- examples/labs/need_data/tmin_statistic.py | 23 ++++++++++---------- examples/labs/need_data/viz3d.py | 7 +++--- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/examples/labs/need_data/one_sample_t_test.py b/examples/labs/need_data/one_sample_t_test.py index 16d41af48d..ff68ce22b3 100644 --- a/examples/labs/need_data/one_sample_t_test.py +++ b/examples/labs/need_data/one_sample_t_test.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function +__doc__ = """ Example of a one-sample t-test using the GLM formalism. This script takes individual contrast images and masks and runs a simple GLM. This can be readily generalized to any design matrix. @@ -14,7 +15,7 @@ Author : Bertrand Thirion, 2012 """ -print __doc__ +print(__doc__) #autoindent from os import mkdir, getcwd, path @@ -85,4 +86,4 @@ black_bg=True) plt.savefig(path.join(write_dir, '%s_z_map.png' % 'one_sample')) plt.show() -print "Wrote all the results in directory %s" % write_dir +print("Wrote all the results in directory %s" % write_dir) diff --git a/examples/labs/need_data/tmin_statistic.py b/examples/labs/need_data/tmin_statistic.py index 50fc0bb9ee..f34979c4a2 100644 --- a/examples/labs/need_data/tmin_statistic.py +++ b/examples/labs/need_data/tmin_statistic.py @@ -1,15 +1,14 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" -Example where the result of the min of two contrasts -is computed and displayed. -This is based on the Localizer dataset, -in which we want to find the regions activated -both in left and right finger tapping. +from __future__ import print_function +__doc__ = """ +Example where the result of the min of two contrasts is computed and displayed. +This is based on the Localizer dataset, in which we want to find the regions +activated both in left and right finger tapping. Notes ------ +----- This is the valid conjunction test discussed in: Nichols T, Brett M, Andersson J, Wager T, Poline JB. Valid conjunction inference with the minimum statistic. Neuroimage. 2005 Apr 15;25(3):653-60. @@ -18,7 +17,7 @@ Author : Bertrand Thirion, 2012 """ -print __doc__ +print(__doc__) from os import mkdir, getcwd, path @@ -67,13 +66,13 @@ if not path.exists(write_dir): mkdir(write_dir) -print 'Computation will be performed in directory: %s' % write_dir +print('Computation will be performed in directory: %s' % write_dir) ######################################## # Design matrix ######################################## -print 'Loading design matrix...' +print('Loading design matrix...') paradigm = load_paradigm_from_csv_file(paradigm_file).values()[0] @@ -98,7 +97,7 @@ # Perform a GLM analysis ######################################## -print 'Fitting a General Linear Model' +print('Fitting a General Linear Model') fmri_glm = FMRILinearModel(data_path, design_matrix.matrix, mask='compute') fmri_glm.fit(do_scaling=True, model='ar1') @@ -131,6 +130,6 @@ plt.savefig(path.join(write_dir, '%s_z_map.png' % contrast_id)) plt.show() -print 'All the results were witten in %s' % write_dir +print('All the results were witten in %s' % write_dir) # Note: fancier visualization of the results are shown # in the viz3d example diff --git a/examples/labs/need_data/viz3d.py b/examples/labs/need_data/viz3d.py index 42062aeb9d..6564616d4e 100644 --- a/examples/labs/need_data/viz3d.py +++ b/examples/labs/need_data/viz3d.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function +__doc__ = """ This examples performs sifferent kinds of (2D and 3D) plots of a given activation map. @@ -9,7 +10,7 @@ Author : Bertrand Thirion, 2012 """ -print __doc__ +print(__doc__) from os import path @@ -64,6 +65,6 @@ anat=None, threshold=4) except ImportError: - print "Need mayavi for 3D visualization" + print("Need mayavi for 3D visualization") plt.show() From 20df8244feecdadd545e4b341f2fb985f7bbf85e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 11 Oct 2012 18:59:22 +0100 Subject: [PATCH 039/164] FIX: fix fetch of only value from dict for py3 Examples using values()[0] - invalid in Python 3; changed to get item ``['0']`` which appears to be correct. --- examples/labs/need_data/glm_beta_and_variance.py | 2 +- examples/labs/need_data/localizer_glm_ar.py | 2 +- examples/labs/need_data/tmin_statistic.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/labs/need_data/glm_beta_and_variance.py b/examples/labs/need_data/glm_beta_and_variance.py index 6f466f2a0e..e5e0cdbafb 100644 --- a/examples/labs/need_data/glm_beta_and_variance.py +++ b/examples/labs/need_data/glm_beta_and_variance.py @@ -76,7 +76,7 @@ print('Loading design matrix...') # the example example.labs.write_paradigm_file shows how to create this file -paradigm = list(load_paradigm_from_csv_file(paradigm_file).values())[0] +paradigm = load_paradigm_from_csv_file(paradigm_file)['0'] design_matrix = make_dmtx(frametimes, paradigm, hrf_model=hrf_model, drift_model=drift_model, hfcut=hfcut) diff --git a/examples/labs/need_data/localizer_glm_ar.py b/examples/labs/need_data/localizer_glm_ar.py index 5ffd0a6933..ef9a8073a3 100755 --- a/examples/labs/need_data/localizer_glm_ar.py +++ b/examples/labs/need_data/localizer_glm_ar.py @@ -77,7 +77,7 @@ print('Loading design matrix...') -paradigm = list(load_paradigm_from_csv_file(paradigm_file).values())[0] +paradigm = load_paradigm_from_csv_file(paradigm_file)['0'] design_matrix = make_dmtx(frametimes, paradigm, hrf_model=hrf_model, drift_model=drift_model, hfcut=hfcut) diff --git a/examples/labs/need_data/tmin_statistic.py b/examples/labs/need_data/tmin_statistic.py index f34979c4a2..c40407ac90 100644 --- a/examples/labs/need_data/tmin_statistic.py +++ b/examples/labs/need_data/tmin_statistic.py @@ -74,7 +74,7 @@ print('Loading design matrix...') -paradigm = load_paradigm_from_csv_file(paradigm_file).values()[0] +paradigm = load_paradigm_from_csv_file(paradigm_file)['0'] design_matrix = make_dmtx(frametimes, paradigm, hrf_model=hrf_model, drift_model=drift_model, hfcut=hfcut) From 6c6cd783043ee4f6bee514f2e1d132b6374a78c7 Mon Sep 17 00:00:00 2001 From: bpinsard Date: Fri, 23 Nov 2012 18:07:27 +0100 Subject: [PATCH 040/164] use_derivatives fix --- nipy/algorithms/registration/optimizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/algorithms/registration/optimizer.py b/nipy/algorithms/registration/optimizer.py index 87f466a41a..9c384a8e61 100644 --- a/nipy/algorithms/registration/optimizer.py +++ b/nipy/algorithms/registration/optimizer.py @@ -48,7 +48,7 @@ def configure_optimizer(optimizer, fprime=None, fhess=None, **kwargs): def use_derivatives(optimizer): - if optimizer in ('fmin_simplex', 'fmin_powell'): + if optimizer in ('simplex', 'powell'): return False else: return True From d3a3996be0799072e3219fb6855670d369b10fe8 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 24 Nov 2012 18:23:16 -0800 Subject: [PATCH 041/164] BF: update before apt-get for travis build See : https://groups.google.com/forum/?fromgroups=#!topic/travis-ci/QbiuGF-8bNU --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 5861869d0f..8669463270 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ env: - PYTHON=python PYSUF='' - PYTHON=python3 PYSUF=3 install: + - sudo apt-get update - sudo apt-get install $PYTHON-dev - sudo apt-get install $PYTHON-numpy - sudo apt-get install $PYTHON-scipy From 02414c2c638da055ae69b13fcb6a7df118aa97f7 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 25 Nov 2012 00:12:05 -0800 Subject: [PATCH 042/164] RF: add ability to run single example in script Make current working directory default log directory. --- tools/run_log_examples.py | 74 +++++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 15 deletions(-) diff --git a/tools/run_log_examples.py b/tools/run_log_examples.py index 62cc0fc8aa..bf67910b43 100755 --- a/tools/run_log_examples.py +++ b/tools/run_log_examples.py @@ -10,12 +10,19 @@ Typical usage is: run_log_examples.py nipy/examples --log-path=~/tmp/eg_logs + +to run the examples and log the result, or + +run_log_examples.py nipy/examples/some_example.py + +to run a single example. """ import sys import os -from os.path import abspath, expanduser, join as pjoin, sep as psep -from subprocess import Popen +from os.path import (abspath, expanduser, join as pjoin, sep as psep, isfile, + dirname) +from subprocess import Popen, PIPE import re from nipy.externals.argparse import (ArgumentParser, @@ -61,6 +68,24 @@ def __call__(self, cmd_name, cmd, args=(), cwd=None): stderr_log.close() return retcode + def run_pipes(self, cmd, args=(), cwd=None): + if cwd is None: + cwd = self.working_path + try: + # Start subprocess + cmd_str = self.cmd_str_maker(cmd, args) + proc = Popen(cmd_str, + cwd = cwd, + stdout = PIPE, + stderr = PIPE, + shell = NEED_SHELL) + # Execute + stdout, stderr = proc.communicate() + finally: + if proc.poll() is None: # In case we get killed + proc.terminate() + return stdout, stderr, proc.returncode + class PyProcLogger(ProcLogger): def cmd_str_maker(self, cmd, args): @@ -76,46 +101,65 @@ def cmd_str_maker(self, cmd, args): """exec(open('{1}', 'rt').read())" """.format(PYTHON, cmd)) +def _record(result, fname, fileobj): + print(result) + fileobj.write('{0}: {1}\n'.format(fname, result)) + + def main(): parser = ArgumentParser(description=DESCRIP, epilog=EPILOG, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('examples_path', type=str, - help='directory containing examples') - parser.add_argument('--log-path', type=str, required=True, - help='path for output logs') + help='filename of example or directory containing ' + 'examples to run') + parser.add_argument('--log-path', type=str, default='', + help='path for output logs (default is cwd)') parser.add_argument('--excludex', type=str, action='append', default=[], help='regex for files to exclude (add more than one ' '--excludex option for more than one regex filter') args = parser.parse_args() # Proc runner eg_path = abspath(expanduser(args.examples_path)) - log_path = abspath(expanduser(args.log_path)) + if args.log_path == '': + log_path = abspath(os.getcwd()) + else: + log_path = abspath(expanduser(args.log_path)) excludexes = [re.compile(s) for s in args.excludex] + if isfile(eg_path): # example was a file + proc_logger = PyProcLogger(log_path=log_path, + working_path=dirname(eg_path)) + print("Running " + eg_path) + stdout, stderr, code = proc_logger.run_pipes(eg_path) + print('==== Stdout ====') + print(stdout) + print('==== Stderr ====') + print(stderr) + sys.exit(code) + # Multi-run with logging to file proc_logger = PyProcLogger(log_path=log_path, working_path=eg_path) fails = 0 with open(pjoin(log_path, 'summary.txt'), 'wt') as f: for dirpath, dirnames, filenames in os.walk(eg_path): for fname in filenames: + full_fname = pjoin(dirpath, fname) if fname.endswith(".py"): print(fname, end=': ') sys.stdout.flush() for excludex in excludexes: if excludex.search(fname): - result_str = "SKIP" - fail = 0 + _record('SKIP', fname, f) break - else: - full_fname = pjoin(dirpath, fname) + else: # run test cmd_name = full_fname.replace(eg_path + psep, '') cmd_name = cmd_name.replace(psep, '-') code = proc_logger(cmd_name, full_fname, cwd=dirpath) - fail = code != 0 - result_str = "FAIL" if fail else "OK" - print(result_str) - f.write('{0}: {1}\n'.format(fname, result_str)) - fails += fail + if code == 0: + _record('OK', fname, f) + else: + fails += 1 + _record('FAIL', fname, f) exit(fails if fails < 255 else 255) From dc6e054c8413778a230f34d5dc6cd080b2146d6c Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 25 Nov 2012 00:26:23 -0800 Subject: [PATCH 043/164] RF: make script outputs strings for printing In python 3 outputs from proc.communicate() come back as byte strings, and they don't print well. Convert to strings. --- tools/run_log_examples.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/run_log_examples.py b/tools/run_log_examples.py index bf67910b43..020145be83 100755 --- a/tools/run_log_examples.py +++ b/tools/run_log_examples.py @@ -25,6 +25,8 @@ from subprocess import Popen, PIPE import re +from nibabel.py3k import asstr + from nipy.externals.argparse import (ArgumentParser, RawDescriptionHelpFormatter) @@ -84,7 +86,7 @@ def run_pipes(self, cmd, args=(), cwd=None): finally: if proc.poll() is None: # In case we get killed proc.terminate() - return stdout, stderr, proc.returncode + return asstr(stdout), asstr(stderr), proc.returncode class PyProcLogger(ProcLogger): From 4913997cced73e6b992c566e939045b478e635d7 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 25 Nov 2012 02:07:10 -0800 Subject: [PATCH 044/164] BF + TEST: refactor fmri model inputs, add tests FMRI model input checking is failing on python 3 because, in python 3, strings have __iter__ attributes, and were therefore not being put into a single element list as intended. Some whitespace and docstring edits. --- nipy/modalities/fmri/glm.py | 12 ++++---- nipy/modalities/fmri/tests/test_glm.py | 41 ++++++++++++++++++++++---- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/nipy/modalities/fmri/glm.py b/nipy/modalities/fmri/glm.py index 6e6175fe45..006069207f 100644 --- a/nipy/modalities/fmri/glm.py +++ b/nipy/modalities/fmri/glm.py @@ -39,6 +39,7 @@ from nipy.labs.mask import compute_mask_sessions from nipy.algorithms.statistics.models.regression import OLSModel, ARModel from nipy.algorithms.statistics.utils import multiple_mahalanobis, z_score +from nipy.core.api import is_image from nipy.testing.decorators import skip_doctest_if from nipy.utils import HAVE_EXAMPLE_DATA @@ -415,9 +416,9 @@ def __init__(self, fmri_data, design_matrices, mask='compute', ---------- fmri_data : Image or str or sequence of Images / str fmri images / paths of the (4D) fmri images - design_matricesi : arrays or str or sequence of arrays / str + design_matrices : arrays or str or sequence of arrays / str design matrix arrays / paths of .npz files - mask : str or Image or None + mask : str or Image or None, optional string can be 'compute' or a path to an image image is an input (assumed binary) mask image(s), if 'compute', the mask is computed @@ -450,13 +451,12 @@ def __init__(self, fmri_data, design_matrices, mask='compute', 671 """ # manipulate the arguments - if not hasattr(fmri_data, '__iter__'): + if isinstance(fmri_data, basestring) or hasattr(fmri_data, 'get_data'): fmri_data = [fmri_data] - if (not hasattr(design_matrices, '__iter__') or - type(design_matrices) == np.ndarray): + if isinstance(design_matrices, (basestring, np.ndarray)): design_matrices = [design_matrices] if len(fmri_data) != len(design_matrices): - raise ValueError('Incompatible number of fmri runs and' + raise ValueError('Incompatible number of fmri runs and ' 'design matrices were provided') self.fmri_data, self.design_matrices = [], [] self.glms, self.means = [], [] diff --git a/nipy/modalities/fmri/tests/test_glm.py b/nipy/modalities/fmri/tests/test_glm.py index f9d7f1d373..c05079e2e9 100644 --- a/nipy/modalities/fmri/tests/test_glm.py +++ b/nipy/modalities/fmri/tests/test_glm.py @@ -6,13 +6,17 @@ from __future__ import with_statement import numpy as np -from nose.tools import assert_true, assert_equal + +from nibabel import load, Nifti1Image, save + +from ..glm import GeneralLinearModel, data_scaling, FMRILinearModel + +from nose.tools import assert_true, assert_equal, assert_raises from numpy.testing import (assert_array_almost_equal, assert_almost_equal, assert_array_equal) -from ..glm import GeneralLinearModel, data_scaling, FMRILinearModel -from nibabel import load, Nifti1Image, save from nibabel.tmpdirs import InTemporaryDirectory +from nipy.testing import funcfile def write_fake_fmri_data(shapes, rk=3, affine=np.eye(4)): @@ -114,6 +118,7 @@ def ar1_glm(n=100, p=80, q=10): glm.fit(Y, 'ar1') return glm, n, p, q + def test_glm_ols(): mulm, n, p, q = ols_glm() assert_array_equal(mulm.labels_, np.zeros(n)) @@ -122,22 +127,26 @@ def test_glm_ols(): assert_almost_equal(mulm.results_[0.0].theta.mean(), 0, 1) assert_almost_equal(mulm.results_[0.0].theta.var(), 1. / p, 1) + def test_glm_beta(): mulm, n, p, q = ols_glm() assert_equal(mulm.get_beta().shape, (q, n)) assert_equal(mulm.get_beta([0, -1]).shape, (2, n)) assert_equal(mulm.get_beta(6).shape, (1, n)) - + + def test_glm_mse(): mulm, n, p, q = ols_glm() mse = mulm.get_mse() assert_array_almost_equal(mse, np.ones(n), 0) + def test_glm_logL(): mulm, n, p, q = ols_glm() logL = mulm.get_logL() assert_array_almost_equal(logL / n, - p * 1.41 * np.ones(n) / n, 0) + def test_glm_ar(): mulm, n, p, q = ar1_glm() assert_equal(len(mulm.labels_), n) @@ -272,7 +281,29 @@ def test_scaling(): assert_almost_equal(Y.mean(0), 0) assert_almost_equal(mean_, mean, 0) assert_true(Y.std() > 1) - + + +def test_fmri_inputs(): + # Test processing of FMRI inputs + func_img = load(funcfile) + T = func_img.shape[-1] + des = np.ones((T, 1)) + des_fname = 'design.npz' + with InTemporaryDirectory(): + np.savez(des_fname, des) + for fi in func_img, funcfile: + for d in des, des_fname: + fmodel = FMRILinearModel(fi, d, mask=None) + fmodel = FMRILinearModel([fi], d, mask=None) + fmodel = FMRILinearModel(fi, [d], mask=None) + fmodel = FMRILinearModel([fi], [d], mask=None) + fmodel = FMRILinearModel([fi, fi], [d, d], mask=None) + fmodel = FMRILinearModel((fi, fi), (d, d), mask=None) + assert_raises(ValueError, FMRILinearModel, [fi, fi], d, + mask=None) + assert_raises(ValueError, FMRILinearModel, fi, [d, d], + mask=None) + if __name__ == "__main__": import nose From 28a437d4f3c73cbba6e4b2a45cf4f9fb9fe7e638 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 25 Nov 2012 02:59:49 -0800 Subject: [PATCH 045/164] BF: change use of iteritems for python 3 Iteritems has gone in python 3 (items is an iterator already). --- examples/labs/need_data/localizer_glm_ar.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/labs/need_data/localizer_glm_ar.py b/examples/labs/need_data/localizer_glm_ar.py index ef9a8073a3..f8d74a1230 100755 --- a/examples/labs/need_data/localizer_glm_ar.py +++ b/examples/labs/need_data/localizer_glm_ar.py @@ -133,7 +133,7 @@ ######################################### print('Computing contrasts...') -for index, (contrast_id, contrast_val) in enumerate(contrasts.iteritems()): +for index, (contrast_id, contrast_val) in enumerate(contrasts.items()): print(' Contrast % 2i out of %i: %s' % (index + 1, len(contrasts), contrast_id)) # save the z_image From c0698f181a33e5bc2573b55fffc3cea9306c7d43 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 25 Nov 2012 03:19:29 -0800 Subject: [PATCH 046/164] BF: add list around .values() for python 3 Python3 dict values method returns a generator, and can't be indexed; make into an explicit list. --- examples/labs/need_data/example_roi_and_glm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/labs/need_data/example_roi_and_glm.py b/examples/labs/need_data/example_roi_and_glm.py index 36bb94aa01..8a2d1d6ba6 100755 --- a/examples/labs/need_data/example_roi_and_glm.py +++ b/examples/labs/need_data/example_roi_and_glm.py @@ -194,7 +194,7 @@ # fit a glm on the ROI's time course glm_fir.fit(roi_tc[k]) # access to the corresponding result structure - res = glm_fir.results_.values()[0] + res = list(glm_fir.results_.values())[0] # only one value in this case plt.subplot(1, my_roi.k, k + 1) # get the confidence intervals for the effects and plot them -condition 0 From 80de8193f2b9e7c155991a7ec2fb3ae05c7c23a4 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 3 Dec 2012 16:16:08 -0800 Subject: [PATCH 047/164] RF: move nipy_diagnose imports to canonical order --- scripts/nipy_diagnose | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/nipy_diagnose b/scripts/nipy_diagnose index 6f1b25a344..d7c139b123 100755 --- a/scripts/nipy_diagnose +++ b/scripts/nipy_diagnose @@ -31,17 +31,15 @@ generate filenames of the form ``/some/path/components_fname.png, import os -import numpy as np +import matplotlib +matplotlib.use('Agg') -import nipy -from nipy.externals.argparse import ArgumentParser, \ - RawDescriptionHelpFormatter -import nipy.algorithms.diagnostics.screens as nads from nibabel.filename_parser import splitext_addext -import matplotlib -matplotlib.use('Agg') -import matplotlib.pyplot as plt +import nipy +from nipy.externals.argparse import (ArgumentParser, + RawDescriptionHelpFormatter) +import nipy.algorithms.diagnostics.screens as nads def main(): @@ -73,7 +71,7 @@ def main(): img = nipy.load_image(filename) res = nads.screen(img, ncomps) nads.write_screen_res(res, out_path, out_root, ext + gz) - + if __name__ == '__main__': main() From 8264e9f85f843af27ebe949a4264af77241da086 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 3 Dec 2012 16:44:18 -0800 Subject: [PATCH 048/164] NF: save percentage variances and vectors from PCA The basis vectors and percent variances for the components are useful for working on later and take up little space. --- nipy/algorithms/diagnostics/screens.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/diagnostics/screens.py b/nipy/algorithms/diagnostics/screens.py index 3cb1ea589f..73577a2f05 100644 --- a/nipy/algorithms/diagnostics/screens.py +++ b/nipy/algorithms/diagnostics/screens.py @@ -76,7 +76,7 @@ def write_screen_res(res, out_path, out_root, out_img_ext='.nii', pcnt_var_thresh=0.1): ''' Write results from ``screen`` to disk as images - + Parameters ---------- res : dict @@ -108,6 +108,10 @@ def write_screen_res(res, out_path, out_root, # plot, save component time courses ncomp = res['pca'].shape[-1] vectors = res['pca_res']['basis_vectors'] + pcnt_var = res['pca_res']['pcnt_var'] + np.savez('vectors_components_%s.npz' % out_root, + basis_vectors=vectors, + pcnt_var=pcnt_var) plt.figure() for c in range(ncomp): plt.subplot(ncomp, 1, c+1) @@ -117,7 +121,6 @@ def write_screen_res(res, out_path, out_root, plt.savefig(pjoin(out_path, 'components_%s.png' % out_root)) # plot percent variance plt.figure() - pcnt_var = res['pca_res']['pcnt_var'] plt.plot(pcnt_var[pcnt_var >= pcnt_var_thresh]) plt.axis('tight') plt.suptitle(out_root + ': PCA percent variance') From c78fd277a1ecdc55045f39a41710c4006a07f4b6 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 5 Dec 2012 12:28:19 -0800 Subject: [PATCH 049/164] ENH: added the opening to the API, and the mask computation now takes an int argument opening (instead of bool) --- nipy/labs/mask.py | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/nipy/labs/mask.py b/nipy/labs/mask.py index 405ac41ce6..5c88a86645 100644 --- a/nipy/labs/mask.py +++ b/nipy/labs/mask.py @@ -76,7 +76,7 @@ def threshold_connect_components(map, threshold, copy=True): def compute_mask_files(input_filename, output_filename=None, return_mean=False, m=0.2, M=0.9, cc=1, - exclude_zeros=False): + exclude_zeros=False, opening=2): """ Compute a mask file from fMRI nifti file(s) @@ -106,6 +106,8 @@ def compute_mask_files(input_filename, output_filename=None, Consider zeros as missing values for the computation of the threshold. This option is useful if the images have been resliced with a large padding of zeros. + opening: int, optional + Size of the morphological opening performed as post-processing Returns ------- @@ -116,8 +118,8 @@ def compute_mask_files(input_filename, output_filename=None, provided if `return_mean` is True. """ if isinstance(input_filename, basestring): - # One single filename - nim = load(input_filename) + # One single filename or image + nim = load(input_filename) # load the image from the path vol_arr = read_img_data(nim, prefer='unscaled') header = nim.get_header() affine = nim.get_affine() @@ -155,7 +157,6 @@ def compute_mask_files(input_filename, output_filename=None, else: mean_volume += nim.get_data().squeeze() mean_volume /= float(len(list(input_filename))) - del nim if np.isnan(mean_volume).any(): tmp = mean_volume.copy() @@ -163,7 +164,7 @@ def compute_mask_files(input_filename, output_filename=None, mean_volume = tmp mask = compute_mask(mean_volume, first_volume, m, M, cc, - exclude_zeros=exclude_zeros) + opening=opening, exclude_zeros=exclude_zeros) if output_filename is not None: header['descrip'] = 'mask' @@ -202,9 +203,9 @@ def compute_mask(mean_volume, reference_volume=None, m=0.2, M=0.9, upper fraction of the histogram to be discarded. cc: boolean, optional if cc is True, only the largest connect component is kept. - opening: boolean, optional - if opening is True, an morphological opening is performed, to keep - only large structures. This step is useful to remove parts of + opening: int, optional + if opening is larger than 0, an morphological opening is performed, + to keep only large structures. This step is useful to remove parts of the skull that might have been included. exclude_zeros: boolean, optional Consider zeros as missing values for the computation of the @@ -235,14 +236,14 @@ def compute_mask(mean_volume, reference_volume=None, m=0.2, M=0.9, if cc: mask = largest_cc(mask) - if opening: + if opening > 0: mask = ndimage.binary_opening(mask.astype(np.int), - iterations=2) + iterations=opening) return mask.astype(bool) -def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, - threshold=0.5, exclude_zeros=False, return_mean=False): +def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, + exclude_zeros=False, return_mean=False, opening=2): """ Compute a common mask for several sessions of fMRI data. Uses the mask-finding algorithmes to extract masks for each @@ -274,6 +275,8 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, return_mean: boolean, optional if return_mean is True, the mean image accross subjects is returned. + opening: int, optional, + size of the morphological opening Returns ------- @@ -285,10 +288,20 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, mask = None mean = None for index, session in enumerate(session_files): - this_mask = compute_mask_files(session, - m=m, M=M, cc=cc, - exclude_zeros=exclude_zeros, - return_mean=return_mean) + if hasattr(session, 'get_data'): + mean = session.get_data() + if mean.ndim > 3: + mean = mean.mean(-1) + this_mask = compute_mask(mean, None, m=m, M=M, cc=cc, + opening=opening, exclude_zeros=exclude_zeros) + if return_mean: + this_mask = this_mask, mean + else: + this_mask = compute_mask_files(session, + m=m, M=M, cc=cc, + exclude_zeros=exclude_zeros, + return_mean=return_mean, + opening=opening) if return_mean: this_mask, this_mean = this_mask if mean is None: From 0412fcfa072290148030b350b7cd0c652e6a0f69 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 5 Dec 2012 12:29:09 -0800 Subject: [PATCH 050/164] ENH: mask computation is now tested. Caveat: does not work with default opening=2 --- nipy/modalities/fmri/glm.py | 2 +- nipy/modalities/fmri/tests/test_glm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nipy/modalities/fmri/glm.py b/nipy/modalities/fmri/glm.py index 006069207f..6f8a4bc3af 100644 --- a/nipy/modalities/fmri/glm.py +++ b/nipy/modalities/fmri/glm.py @@ -481,7 +481,7 @@ def __init__(self, fmri_data, design_matrices, mask='compute', # load the mask if mask == 'compute': mask = compute_mask_sessions( - fmri_data, m=m, M=M, cc=1, threshold=threshold) + fmri_data, m=m, M=M, cc=1, threshold=threshold, opening=0) self.mask = Nifti1Image(mask.astype(np.int8), self.affine) elif mask == None: mask = np.ones(self.fmri_data[0].shape[:3]).astype(np.int8) diff --git a/nipy/modalities/fmri/tests/test_glm.py b/nipy/modalities/fmri/tests/test_glm.py index c05079e2e9..d8b4c2fda2 100644 --- a/nipy/modalities/fmri/tests/test_glm.py +++ b/nipy/modalities/fmri/tests/test_glm.py @@ -293,7 +293,7 @@ def test_fmri_inputs(): np.savez(des_fname, des) for fi in func_img, funcfile: for d in des, des_fname: - fmodel = FMRILinearModel(fi, d, mask=None) + fmodel = FMRILinearModel(fi, d, mask='compute') fmodel = FMRILinearModel([fi], d, mask=None) fmodel = FMRILinearModel(fi, [d], mask=None) fmodel = FMRILinearModel([fi], [d], mask=None) From ae60975b77fc3141b461c2dcc16becb116781f1f Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 5 Dec 2012 18:26:32 -0800 Subject: [PATCH 051/164] BF: added a test to see the effect of opening --- nipy/labs/mask.py | 2 +- nipy/labs/tests/test_mask.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nipy/labs/mask.py b/nipy/labs/mask.py index 5c88a86645..82f30d06ce 100644 --- a/nipy/labs/mask.py +++ b/nipy/labs/mask.py @@ -179,7 +179,7 @@ def compute_mask_files(input_filename, output_filename=None, def compute_mask(mean_volume, reference_volume=None, m=0.2, M=0.9, - cc=True, opening=True, exclude_zeros=False): + cc=True, opening=2, exclude_zeros=False): """ Compute a mask file from fMRI data in 3D or 4D ndarrays. diff --git a/nipy/labs/tests/test_mask.py b/nipy/labs/tests/test_mask.py index 17b8aa3fda..78c2b29391 100644 --- a/nipy/labs/tests/test_mask.py +++ b/nipy/labs/tests/test_mask.py @@ -58,7 +58,13 @@ def test_mask(): # However, without exclude_zeros, it does mask3 = nnm.compute_mask(mean_image2) yield assert_false, np.allclose(mask1, mask3[:9, :9]) - + # check that opening is 2 by default + mask4 = nnm.compute_mask(mean_image, exclude_zeros=True, opening=2) + assert_array_equal(mask1, mask4) + # check that opening has an effect + mask5 = nnm.compute_mask(mean_image, exclude_zeros=True, opening=0) + yield assert_true, mask5.sum() > mask4.sum() + def test_mask_files(): with InTemporaryDirectory(): From fac6011b310e8632ceaf3eccbc3123dd5af7687a Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 5 Dec 2012 17:21:58 -0800 Subject: [PATCH 052/164] BF+NF: fix path to save arrays; add tsdiff arrays I wasn't using the output path for saving the `.npz` file, and thus saving in the python current directory. Added the tsdiffana time courses. --- nipy/algorithms/diagnostics/screens.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/nipy/algorithms/diagnostics/screens.py b/nipy/algorithms/diagnostics/screens.py index 73577a2f05..989c382be8 100644 --- a/nipy/algorithms/diagnostics/screens.py +++ b/nipy/algorithms/diagnostics/screens.py @@ -105,13 +105,16 @@ def write_screen_res(res, out_path, out_root, out_root, out_img_ext)) save_image(res[key], fname) - # plot, save component time courses + # plot, save component time courses and some tsdiffana stuff ncomp = res['pca'].shape[-1] vectors = res['pca_res']['basis_vectors'] pcnt_var = res['pca_res']['pcnt_var'] - np.savez('vectors_components_%s.npz' % out_root, + np.savez(pjoin(out_path, 'vectors_components_%s.npz' % out_root), basis_vectors=vectors, - pcnt_var=pcnt_var) + pcnt_var=pcnt_var, + volume_means=res['ts_res']['volume_means'], + slice_mean_diff2=res['ts_res']['slice_mean_diff2'], + ) plt.figure() for c in range(ncomp): plt.subplot(ncomp, 1, c+1) From 4880ff2e09534f84d8722cac5ee293ee2f454a6c Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 5 Dec 2012 18:54:36 -0800 Subject: [PATCH 053/164] ENH: Added a test for multiple session mask --- nipy/labs/tests/test_mask.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/nipy/labs/tests/test_mask.py b/nipy/labs/tests/test_mask.py index 78c2b29391..218a95e082 100644 --- a/nipy/labs/tests/test_mask.py +++ b/nipy/labs/tests/test_mask.py @@ -60,7 +60,7 @@ def test_mask(): yield assert_false, np.allclose(mask1, mask3[:9, :9]) # check that opening is 2 by default mask4 = nnm.compute_mask(mean_image, exclude_zeros=True, opening=2) - assert_array_equal(mask1, mask4) + yield assert_array_equal, mask1, mask4 # check that opening has an effect mask5 = nnm.compute_mask(mean_image, exclude_zeros=True, opening=0) yield assert_true, mask5.sum() > mask4.sum() @@ -116,6 +116,31 @@ def test_series_from_mask(): series, header = series_from_mask('testing.nii', mask, smooth=9) assert_true(np.all(np.isfinite(series))) +def test_compute_mask_sessions(): + """Test that the mask computes well on multiple sessions + """ + with InTemporaryDirectory(): + # Make a 4D file from the anatomical example + img = nib.load(anatfile) + arr = img.get_data() + a2 = np.zeros(arr.shape + (2, )) + a2[:, :, :, 0] = arr + a2[:, :, :, 1] = arr + img = nib.Nifti1Image(a2, np.eye(4)) + a_fname = 'fourd_anat.nii' + nib.save(img, a_fname) + a3 = a2.copy() + a3[:10, :10, :10] = 0 + img2 = nib.Nifti1Image(a3, np.eye(4)) + # check 4D mask + msk1 = nnm.compute_mask_sessions([img2, img2]) + msk2 = nnm.compute_mask_sessions([img2, a_fname]) + assert_array_equal(msk1, msk2) + msk3 = nnm.compute_mask_sessions([img2, a_fname], threshold=.9) + msk4 = nnm.compute_mask_sessions([img2, a_fname], threshold=0) + msk5 = nnm.compute_mask_sessions([a_fname, a_fname]) + assert_array_equal(msk1, msk3) + assert_array_equal(msk4, msk5) if __name__ == "__main__": import nose From fe0cc83c46fd400b82a10d715ddbd1552e882000 Mon Sep 17 00:00:00 2001 From: bthirion Date: Fri, 7 Dec 2012 16:38:47 -0800 Subject: [PATCH 054/164] ENH: corrected docstrings in mask --- nipy/labs/mask.py | 102 +++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/nipy/labs/mask.py b/nipy/labs/mask.py index 82f30d06ce..50732a2235 100644 --- a/nipy/labs/mask.py +++ b/nipy/labs/mask.py @@ -21,15 +21,15 @@ def largest_cc(mask): """ Return the largest connected component of a 3D mask array. - Parameters - ----------- - mask: 3D boolean array - 3D array indicating a mask. - - Returns - -------- - mask: 3D boolean array - 3D array indicating a mask, with only one connected component. + Parameters + ----------- + mask: 3D boolean array + 3D array indicating a mask. + + Returns + -------- + mask: 3D boolean array + 3D array indicating a mask, with only one connected component. """ # We use asarray to be able to work with masked arrays. mask = np.asarray(mask) @@ -49,14 +49,19 @@ def threshold_connect_components(map, threshold, copy=True): connect components with number of voxels smaller than the threshold and set them to 0. - Parameters - ---------- - map: ndarray - The map to segment - threshold: - The minimum number of voxels to keep a cluster. - copy: bool, optional - If copy is false, the input array is modified inplace + Parameters + ---------- + map: ndarray, + The spatial map to segment + threshold: scalar, + The minimum number of voxels to keep a cluster. + copy: bool, optional + If copy is false, the input array is modified inplace + + Returns + ------- + map: ndarray, + the map with connected components removed """ labels, _ = ndimage.label(map) weights = np.bincount(labels.ravel()) @@ -119,7 +124,7 @@ def compute_mask_files(input_filename, output_filename=None, """ if isinstance(input_filename, basestring): # One single filename or image - nim = load(input_filename) # load the image from the path + nim = load(input_filename) # load the image from the path vol_arr = read_img_data(nim, prefer='unscaled') header = nim.get_header() affine = nim.get_affine() @@ -204,7 +209,7 @@ def compute_mask(mean_volume, reference_volume=None, m=0.2, M=0.9, cc: boolean, optional if cc is True, only the largest connect component is kept. opening: int, optional - if opening is larger than 0, an morphological opening is performed, + if opening is larger than 0, an morphological opening is performed, to keep only large structures. This step is useful to remove parts of the skull that might have been included. exclude_zeros: boolean, optional @@ -253,21 +258,21 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, Parameters ---------- - session_files : list of list of strings - A list of list of nifti filenames. Each inner list + session_files : list of (list of strings) or nipy image objects + A list of images/list of nifti filenames. Each inner list/image represents a session. - threshold : float, optional - the inter-session threshold: the fraction of the - total number of session in for which a voxel must be in the - mask to be kept in the common mask. - threshold=1 corresponds to keeping the intersection of all - masks, whereas threshold=0 is the union of all masks. m : float, optional lower fraction of the histogram to be discarded. M: float, optional upper fraction of the histogram to be discarded. cc: boolean, optional if cc is True, only the largest connect component is kept. + threshold : float, optional + the inter-session threshold: the fraction of the + total number of session in for which a voxel must be in the + mask to be kept in the common mask. + threshold=1 corresponds to keeping the intersection of all + masks, whereas threshold=0 is the union of all masks. exclude_zeros: boolean, optional Consider zeros as missing values for the computation of the threshold. This option is useful if the images have been @@ -285,8 +290,7 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, mean : 3D float array The mean image """ - mask = None - mean = None + mask, mean = None, None for index, session in enumerate(session_files): if hasattr(session, 'get_data'): mean = session.get_data() @@ -297,11 +301,9 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, if return_mean: this_mask = this_mask, mean else: - this_mask = compute_mask_files(session, - m=m, M=M, cc=cc, - exclude_zeros=exclude_zeros, - return_mean=return_mean, - opening=opening) + this_mask = compute_mask_files( + session, m=m, M=M, cc=cc, exclude_zeros=exclude_zeros, + return_mean=return_mean, opening=opening) if return_mean: this_mask, this_mean = this_mask if mean is None: @@ -408,30 +410,30 @@ def series_from_mask(filenames, mask, dtype=np.float32, smooth=False, ensure_finite=True): """ Read the time series from the given sessions filenames, using the mask. - Parameters - ----------- - filenames: list of 3D nifti file names, or 4D nifti filename. - Files are grouped by session. - mask: 3d ndarray - 3D mask array: true where a voxel should be used. - smooth: False or float, optional + Parameters + ----------- + filenames: list of 3D nifti file names, or 4D nifti filename. + Files are grouped by session. + mask: 3d ndarray + 3D mask array: true where a voxel should be used. + smooth: False or float, optional If smooth is not False, it gives the size, in voxel of the spatial smoothing to apply to the signal. - ensure_finite: boolean + ensure_finite: boolean, optional If ensure_finite is True, the non-finite values (NaNs and infs) found in the images will be replaced by zeros - Returns - -------- - session_series: ndarray + Returns + -------- + session_series: ndarray 3D array of time course: (session, voxel, time) - header: header object + header: header object The header of the first file. - Notes - ----- - When using smoothing, ensure_finite should be True: as elsewhere non - finite values will spread accross the image. + Notes + ----- + When using smoothing, ensure_finite should be True: as elsewhere non + finite values will spread accross the image. """ assert len(filenames) != 0, ( 'filenames should be a file name or a list of file names, ' From fd6ae5204a2763795c4554cc288b98c7368f3991 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sat, 8 Dec 2012 08:45:08 -0800 Subject: [PATCH 055/164] ENH: variable renaming for consistency --- nipy/labs/mask.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nipy/labs/mask.py b/nipy/labs/mask.py index 50732a2235..aa3652c51e 100644 --- a/nipy/labs/mask.py +++ b/nipy/labs/mask.py @@ -247,7 +247,7 @@ def compute_mask(mean_volume, reference_volume=None, m=0.2, M=0.9, return mask.astype(bool) -def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, +def compute_mask_sessions(session_images, m=0.2, M=0.9, cc=1, threshold=0.5, exclude_zeros=False, return_mean=False, opening=2): """ Compute a common mask for several sessions of fMRI data. @@ -258,7 +258,7 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, Parameters ---------- - session_files : list of (list of strings) or nipy image objects + session_images : list of (list of strings) or nipy image objects A list of images/list of nifti filenames. Each inner list/image represents a session. m : float, optional @@ -291,7 +291,7 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, The mean image """ mask, mean = None, None - for index, session in enumerate(session_files): + for index, session in enumerate(session_images): if hasattr(session, 'get_data'): mean = session.get_data() if mean.ndim > 3: @@ -320,7 +320,7 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, # Take the "half-intersection", i.e. all the voxels that fall within # 50% of the individual masks. - mask = (mask > threshold * len(list(session_files))) + mask = (mask > threshold * len(list(session_images))) if cc: # Select the largest connected component (each mask is @@ -330,7 +330,7 @@ def compute_mask_sessions(session_files, m=0.2, M=0.9, cc=1, threshold=0.5, if return_mean: # Divide by the number of sessions - mean /= len(session_files) + mean /= len(session_images) return mask, mean return mask From d0db702132298fc0374a030372e1c1229e7e4d84 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 11 Dec 2012 17:35:23 -0800 Subject: [PATCH 056/164] BF: missing sys for sys.exit I didn't test the script before committing, what a fool. --- tools/run_log_examples.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/run_log_examples.py b/tools/run_log_examples.py index 020145be83..af5276efcb 100755 --- a/tools/run_log_examples.py +++ b/tools/run_log_examples.py @@ -162,7 +162,7 @@ def main(): else: fails += 1 _record('FAIL', fname, f) - exit(fails if fails < 255 else 255) + sys.exit(fails if fails < 255 else 255) if __name__ == '__main__': From 485d4da6780eb0febaeb9837d4cdc624df9634e0 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 15 Dec 2012 12:28:01 -0600 Subject: [PATCH 057/164] NF: convert nipy image with 'unknown' world to nii We previously raised an error if we had a nipy image with the 'unknown' image space when converting to nifti, because 'unknown' cannot be stored in nifti unless the affine is discarded. But, if the affine of the image to be converted is already the same as that resulting from discarding the affine, there's no harm, and it allows us to round-trip images without specified (``sform, qform``) affines. --- nipy/io/nifti_ref.py | 18 +++++++++++++----- nipy/io/tests/test_nifti_ref.py | 27 +++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/nipy/io/nifti_ref.py b/nipy/io/nifti_ref.py index c4affbc715..0e2b2dde7c 100644 --- a/nipy/io/nifti_ref.py +++ b/nipy/io/nifti_ref.py @@ -236,9 +236,11 @@ def nipy2nifti(img, data_dtype=None, strict=None, fix0=False): NiftiError. We check if the XYZ output fits with the NIFTI named spaces of scanner, - aligned, Talairach, MNI. If not we raise an error. Note that 'unknown' is - not a known space for NIFTI, because it cannot be set without also deleting - the affine. + aligned, Talairach, MNI. If so, set the NIFTI code and qform, sform + accordingly. If the space corresponds to 'unknown' then we must set the + NIFTI transform codes to 0, and the affine must match the affine we will get + from loading the NIFTI with no qform, sform. If not, we're going to lose + information in the affine, and raise an error. If any of the first three input axes are named ('slice', 'freq', 'phase') set the ``dim_info`` field accordingly. @@ -331,9 +333,15 @@ def nipy2nifti(img, data_dtype=None, strict=None, fix0=False): stacklevel = 2) hdr.set_sform(xyz_affine, 'scanner') hdr.set_qform(xyz_affine, 'scanner') - else: + elif not out_space in ncrs.unknown_space: # no space we recognize raise NiftiError('Image world not a NIFTI world') - # Set dim_info + else: # unknown space requires affine that matches + if not np.allclose(xyz_affine, hdr.get_base_affine()): + raise NiftiError("Image world is 'unknown' but affine not " + "compatible; please reset image world or " + "affine") + hdr.set_qform(None) + hdr.set_sform(None) # Use list() to get .index method for python < 2.6 input_names = list(coordmap.function_domain.coord_names) spatial_names = input_names[:3] diff --git a/nipy/io/tests/test_nifti_ref.py b/nipy/io/tests/test_nifti_ref.py index 528f81cafb..48f702ac2f 100644 --- a/nipy/io/tests/test_nifti_ref.py +++ b/nipy/io/tests/test_nifti_ref.py @@ -17,7 +17,8 @@ AffineTransform as AT, CoordinateSystem as CS) from ...core.reference.spaces import (unknown_csm, scanner_csm, aligned_csm, - talairach_csm, mni_csm, vox2mni) + talairach_csm, mni_csm, unknown_space, + vox2mni) from ..files import load from ..nifti_ref import (nipy2nifti, nifti2nipy, NiftiError) @@ -94,10 +95,32 @@ def test_xyz_affines(): assert_raises(NiftiError, nipy2nifti, aimg[:, 1, :]) assert_raises(NiftiError, nipy2nifti, aimg[1, :, :]) # Do not allow spaces not in the NIFTI canon + for i in range(3): + displaced_img = fimg.renamed_reference(**{out_coords[i]: 'obscure'}) + assert_raises(NiftiError, nipy2nifti, displaced_img) + + +def test_unknown(): + # The 'unknown' coordinate space results from loading an image with no + # affine set; allow setting into nifti iff the affine corresponds to the + # default that would be created when there is no affine + aimg = copy_of(anatfile) + bare_affine = aimg.metadata['header'].get_base_affine() + # The affine does not match the header-only affine + assert_false(np.allclose(bare_affine, aimg.coordmap.affine)) unknown_cs = unknown_csm(3) - displaced_img = fimg.renamed_reference( + out_coords = aimg.reference.coord_names + # So nipy2nifti raises an error + displaced_img = aimg.renamed_reference( **dict(zip(out_coords[:3], unknown_cs.coord_names))) assert_raises(NiftiError, nipy2nifti, displaced_img) + # If the affine is the same, no error + displaced_img.coordmap.affine[:] = bare_affine + assert_true(np.allclose(bare_affine, displaced_img.coordmap.affine)) + nimg = nipy2nifti(displaced_img) + assert_array_equal(nimg.get_affine(), bare_affine) + inimg = nifti2nipy(nimg) + assert_true(inimg.coordmap.function_range in unknown_space) def test_orthogonal_dims(): From 008224cbda258f3b57eba9a362dd25b26e26f299 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 17 Dec 2012 11:01:10 -0600 Subject: [PATCH 058/164] RF: better tests of current axis finding algorithm I didn't understand it myself, so working through with tests --- nipy/core/reference/coordinate_map.py | 2 +- nipy/core/reference/tests/test_coordinate_map.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index a2c446ac48..e4eea6132a 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -1986,7 +1986,7 @@ def io_axis_indices(coordmap, axis_id, fix0=False): Raises ------ - AxisError: if `axis_id` is a str and does not match any no input or output + AxisError: if `axis_id` is a str and does not match any input or output coordinate names. AxisError: if the named `axis_id` exists in both input and output, and they do not correspond. diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index 2a041a2e46..7f0fed59d2 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -819,10 +819,15 @@ def test_io_axis_indices(): assert_equal(io_axis_indices(cmap_m, i), (i, 2-i)) assert_equal(io_axis_indices(cmap_m, in_name), (i, 2-i)) assert_equal(io_axis_indices(cmap_m, out_name), (2-i, i)) - # If they don't match, AxisError + # If they don't match, AxisError, if selecting by name cmap_b = AffineTransform('ijk', 'xiz', np.eye(4)) - assert_equal(io_axis_indices(cmap_m, 'j'), (1, 1)) assert_raises(AxisError, io_axis_indices, cmap_b, 'i') + # ... but not if name corresponds + assert_equal(io_axis_indices(cmap_b, 'k'), (2, 2)) + # ... or if input name not found in output + assert_equal(io_axis_indices(cmap_b, 'j'), (1, 1)) + # ... or if selecting by number + assert_equal(io_axis_indices(cmap_b, 0), (0, 0)) # Name not found, AxisError assert_raises(AxisError, io_axis_indices, cmap_b, 'q') # 0 usually leads to no match From a6b469d83279739c956f01c26b11d6dead88c87d Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 17 Dec 2012 13:10:25 -0600 Subject: [PATCH 059/164] RF: make fix0=True default for axis routines I believe fix0 is benign and there are many TR=0 images out there; make fix0=True the default so people don't often have to futz with the affine in TR=0 case. --- examples/fiac/fiac_example.py | 2 +- nipy/core/reference/coordinate_map.py | 9 +++-- .../reference/tests/test_coordinate_map.py | 40 +++++++++++++------ nipy/io/nifti_ref.py | 2 +- nipy/io/tests/test_nifti_ref.py | 24 +++++++---- 5 files changed, 51 insertions(+), 26 deletions(-) diff --git a/examples/fiac/fiac_example.py b/examples/fiac/fiac_example.py index 200de69fce..c96c32604a 100644 --- a/examples/fiac/fiac_example.py +++ b/examples/fiac/fiac_example.py @@ -182,7 +182,7 @@ def run_model(subj, run): # Load in the fMRI data, saving it as an array. It is transposed to have # time as the first dimension, i.e. fmri[t] gives the t-th volume. fmri_im = futil.get_fmri(path_info) # an Image - fmri_im = rollimg(fmri_im, 't', fix0=True) + fmri_im = rollimg(fmri_im, 't') fmri = fmri_im.get_data() # now, it's an ndarray nvol, volshape = fmri.shape[0], fmri.shape[1:] diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index e4eea6132a..9cfcf88eaa 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -1848,7 +1848,7 @@ def append_io_dim(cm, in_name, out_name, start=0, step=1): return product(cm, extra_cmap) -def axmap(coordmap, direction='in2out', fix0=False): +def axmap(coordmap, direction='in2out', fix0=True): """ Return mapping between input and output axes Parameters @@ -1901,7 +1901,7 @@ def axmap(coordmap, direction='in2out', fix0=False): return in2out_map, out2in_map -def input_axis_index(coordmap, axis_id, fix0=False): +def input_axis_index(coordmap, axis_id, fix0=True): """ Return input axis index for `axis_id` `axis_id` can be integer, or a name of an input axis, or it can be the name @@ -1916,7 +1916,8 @@ def input_axis_index(coordmap, axis_id, fix0=False): input axis, or the name of an output axis that should have a corresponding input axis (see Raises section). fix0: bool, optional - Whether to fix potential 0 TR in affine + Whether to fix potential single 0 on diagonal of affine. This often + happens when loading nifti images with TR set to 0. Returns ------- @@ -1961,7 +1962,7 @@ def input_axis_index(coordmap, axis_id, fix0=False): return in_no -def io_axis_indices(coordmap, axis_id, fix0=False): +def io_axis_indices(coordmap, axis_id, fix0=True): """ Return input and output axis index for id `axis_id` in `coordmap` Parameters diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index 7f0fed59d2..5851b251a3 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -718,13 +718,21 @@ def test_axmap(): 'i': 2, 'j': 0, 'k': 1}) assert_equal(axmap(cmap, 'out2in'), {2: 0, 0: 1, 1: 2, 'z': 0, 'x': 1, 'y': 2}) + # Test in presence of nasty zero cmap = AffineTransform('ijk', 'xyz', np.diag([2, 3, 0, 1])) - assert_equal(axmap(cmap), {0: 0, 1: 1, 2: None, - 'i': 0, 'j': 1, 'k': None}) - assert_equal(axmap(cmap, 'out2in'), {0: 0, 1: 1, 2: None, - 'x': 0, 'y': 1, 'z': None}) + # Default is to fix zero + assert_equal(axmap(cmap), {0: 0, 1: 1, 2: 2, + 'i': 0, 'j': 1, 'k': 2}) assert_equal(axmap(cmap, fix0=True), {0: 0, 1: 1, 2: 2, 'i': 0, 'j': 1, 'k': 2}) + assert_equal(axmap(cmap, 'out2in'), {0: 0, 1: 1, 2: 2, + 'x': 0, 'y': 1, 'z': 2}) + # If turned off, we can't find the axis anymore + assert_equal(axmap(cmap, fix0=False), {0: 0, 1: 1, 2: None, + 'i': 0, 'j': 1, 'k': None}) + assert_equal(axmap(cmap, 'out2in', fix0=False), {0: 0, 1: 1, 2: None, + 'x': 0, 'y': 1, 'z': None}) + # Need in2out or out2in as action strings assert_raises(ValueError, axmap, cmap, 'do what exactly?') # Non-square cmap = AffineTransform('ij', 'xyz', [[0, 1, 0], @@ -792,12 +800,13 @@ def test_input_axis_index(): assert_raises(AxisError, input_axis_index, cmap_b, 'i') # Name not found, AxisError assert_raises(AxisError, input_axis_index, cmap_b, 'q') - # 0 usually leads to no match + # 0 leads to no match if fix0 turned off cmap_z = AffineTransform('ijk', 'xyz', np.diag([2, 3, 0, 1])) - assert_equal(input_axis_index(cmap_z, 'y'), 1) - assert_raises(AxisError, input_axis_index, cmap_z, 'z') - # Unless fix0 in place + assert_equal(input_axis_index(cmap_z, 'z'), 2) assert_equal(input_axis_index(cmap_z, 'z', fix0=True), 2) + assert_raises(AxisError, input_axis_index, cmap_z, 'z', fix0=False) + # Other axes not affected in presence of 0 + assert_equal(input_axis_index(cmap_z, 'y'), 1) def test_io_axis_indices(): @@ -830,14 +839,19 @@ def test_io_axis_indices(): assert_equal(io_axis_indices(cmap_b, 0), (0, 0)) # Name not found, AxisError assert_raises(AxisError, io_axis_indices, cmap_b, 'q') - # 0 usually leads to no match + # 0 leads to no match if fix0 set to false cmap_z = AffineTransform('ijk', 'xyz', np.diag([2, 3, 0, 1])) assert_equal(io_axis_indices(cmap_z, 'y'), (1, 1)) - assert_equal(io_axis_indices(cmap_z, 'z'), (None, 2)) + assert_equal(io_axis_indices(cmap_z, 'z'), (2, 2)) + assert_equal(io_axis_indices(cmap_z, 'z', fix0=False), (None, 2)) # For either input or output - assert_equal(io_axis_indices(cmap_z, 'k'), (2, None)) - # Unless fix0 in place - assert_equal(io_axis_indices(cmap_z, 'z', fix0=True), (2, 2)) + assert_equal(io_axis_indices(cmap_z, 'k'), (2, 2)) + assert_equal(io_axis_indices(cmap_z, 'k', fix0=False), (2, None)) + # axis name and number access without fix0 + cmap = AffineTransform('ijkt', 'xyzt', np.diag([1, 1, 1, 0, 1])) + assert_raises(AxisError, io_axis_indices, cmap, 't', fix0=False) + in_ax, out_ax = io_axis_indices(cmap, -1, fix0=False) + assert_equal((in_ax, out_ax), (3, None)) # Non-square is OK cmap = AffineTransform('ij', 'xyz', [[0, 1, 0], [0, 0, 0], diff --git a/nipy/io/nifti_ref.py b/nipy/io/nifti_ref.py index c4affbc715..8686dc4e8d 100644 --- a/nipy/io/nifti_ref.py +++ b/nipy/io/nifti_ref.py @@ -176,7 +176,7 @@ class NiftiError(Exception): pass -def nipy2nifti(img, data_dtype=None, strict=None, fix0=False): +def nipy2nifti(img, data_dtype=None, strict=None, fix0=True): """ Return NIFTI image from nipy image `img` Parameters diff --git a/nipy/io/tests/test_nifti_ref.py b/nipy/io/tests/test_nifti_ref.py index 528f81cafb..9103cd70d9 100644 --- a/nipy/io/tests/test_nifti_ref.py +++ b/nipy/io/tests/test_nifti_ref.py @@ -339,29 +339,39 @@ def test_save_toffset(): CS(xyz_names + ('u', t_name, 'v')), np.diag([3, 4, 5, 6, 0, 7, 1])) assert_equal(nipy2nifti(Image(data, cmap)).shape, shape_shifted) - # toffset, non-matching error + # toffset with 0 on TR (time) diagonal aff_z1 = from_matvec(np.diag([2., 3, 4, 5, 0, 7]), [11, 12, 13, 14, 15, 16]) cmap = AT(CS(('i', 'j', 'k', 'u', t_name, 'v')), CS(xyz_names + ('u', t_name, 'v')), aff_z1) - assert_raises(NiftiError, nipy2nifti, Image(data, cmap)) - # Unless fix0 set + # Default is to fix the zero + assert_equal(nipy2nifti(Image(data, cmap)).shape, + shape_shifted) assert_equal(nipy2nifti(Image(data, cmap), fix0=True).shape, shape_shifted) - # Even this doesn't work if there is more than one zero row and column + # Unless fix0 is False + assert_raises(NiftiError, nipy2nifti, Image(data, cmap), fix0=False) + # Fix doesn't work if there is more than one zero row and column aff_z2 = from_matvec(np.diag([2., 3, 4, 0, 0, 7]), [11, 12, 13, 14, 15, 16]) cmap = AT(CS(('i', 'j', 'k', 'u', t_name, 'v')), CS(xyz_names + ('u', t_name, 'v')), aff_z2) assert_raises(NiftiError, nipy2nifti, Image(data, cmap), fix0=True) - # No problem for non-time + # zeros on the diagonal are not a problem for non-time, with toffset, + # because we don't need to set the 'time' part of the translation vector, + # and therefore we don't need to know which *output axis* is time-like for t_name in 'hz', 'ppm', 'rads': cmap = AT(CS(('i', 'j', 'k', 'u', t_name, 'v')), CS(xyz_names + ('u', t_name, 'v')), - aff) - assert_equal(nipy2nifti(Image(data, cmap), fix0=True).shape, + aff_z1) + assert_equal(nipy2nifti(Image(data, cmap), fix0=False).shape, + shape_shifted) + cmap = AT(CS(('i', 'j', 'k', 'u', t_name, 'v')), + CS(xyz_names + ('u', t_name, 'v')), + aff_z2) + assert_equal(nipy2nifti(Image(data, cmap), fix0=False).shape, shape_shifted) From 047a6dc1bafc90977a2730fa4b55e28ebdaaa42c Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 17 Dec 2012 16:19:40 -0600 Subject: [PATCH 060/164] BF: strange error when passing bool as mask type np.bool_ as very reasonable mask input type caused an error for np.nan_to_num. Only run nan_to_num if floating point mask type. --- nipy/algorithms/utils/pca.py | 12 +++++++++++- nipy/algorithms/utils/tests/test_pca.py | 14 +++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/nipy/algorithms/utils/pca.py b/nipy/algorithms/utils/pca.py index 6afddc9ab5..fb3e7089c5 100644 --- a/nipy/algorithms/utils/pca.py +++ b/nipy/algorithms/utils/pca.py @@ -98,6 +98,9 @@ def pca(data, axis=0, mask=None, ncomp=None, standardize=True, data = np.rollaxis(data, axis) if mask is not None: mask = np.asarray(mask) + if not data.shape[1:] == mask.shape: + raise ValueError('Mask should match dimensions of data other than ' + 'the axis over which to do the PCA') if design_resid == 'mean': # equivalent to: design_resid = np.ones((data.shape[0], 1)) def project_resid(Y): @@ -173,6 +176,10 @@ def _get_covariance(data, UX, rmse_scales_func, mask): # number of points in PCA dimension rank, n_pts = UX.shape C = np.zeros((rank, rank)) + # nan_to_num only for floating point masks + if not mask is None: + nan_to_num = mask.dtype.type in (np.sctypes['float'] + + np.sctypes['complex']) # loop over next dimension to save memory if data.ndim == 2: # If we have 2D data, just do the covariance all in one shot, by using @@ -190,7 +197,10 @@ def _get_covariance(data, UX, rmse_scales_func, mask): YX *= rmse_scales_func(Y) if mask is not None: # weight data with mask. Usually the weights will be 0,1 - YX = YX * np.nan_to_num(mask[s_slice].reshape(Y.shape[1])) + msk_slice = mask[s_slice].reshape(Y.shape[1]) + if nan_to_num: # but if floats, check for NaNs too. + msk_slice = np.nan_to_num(msk_slice) + YX = YX * msk_slice C += np.dot(YX, YX.T) return C diff --git a/nipy/algorithms/utils/tests/test_pca.py b/nipy/algorithms/utils/tests/test_pca.py index 7673968704..6ca8088d35 100644 --- a/nipy/algorithms/utils/tests/test_pca.py +++ b/nipy/algorithms/utils/tests/test_pca.py @@ -163,7 +163,19 @@ def test_PCAMask(): assert_equal(p['basis_vectors'].shape, (data['nimages'], ntotal)) assert_equal(p['basis_projections'].shape, mask.shape + (ncomp,)) assert_equal(p['pcnt_var'].shape, (ntotal,)) - assert_almost_equal(p['pcnt_var'].sum(), 100.) + assert_almost_equal(p['pcnt_var'].sum(), 100.) + # Any reasonable datatype for mask + for dt in ([np.bool_] + + np.sctypes['int'] + + np.sctypes['uint'] + + np.sctypes['float']): + p = pca(arr4d, -1, mask3d.astype(dt), ncomp=ncomp) + assert_equal(p['basis_vectors'].shape, (data['nimages'], ntotal)) + assert_equal(p['basis_projections'].shape, mask3d.shape + (ncomp,)) + assert_equal(p['pcnt_var'].shape, (ntotal,)) + assert_almost_equal(p['pcnt_var'].sum(), 100.) + # Mask data shape must match + assert_raises(ValueError, pca, arr4d, -1, mask1d) def test_PCAMask_nostandardize(): From 0ff447991d955af4551bde7e20a309a7e8821075 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 17 Dec 2012 22:33:56 -0600 Subject: [PATCH 061/164] TST: Add tests for nipy_* scripts We weren't testing the scripts until now. --- nipy/setup.py | 2 +- nipy/tests/__init__.py | 1 + nipy/tests/test_scripts.py | 107 +++++++++++++++++++++++++++++++++++++ 3 files changed, 109 insertions(+), 1 deletion(-) create mode 100644 nipy/tests/__init__.py create mode 100644 nipy/tests/test_scripts.py diff --git a/nipy/setup.py b/nipy/setup.py index ae64236db2..005fbd5281 100644 --- a/nipy/setup.py +++ b/nipy/setup.py @@ -45,7 +45,7 @@ def configuration(parent_package='',top_path=None): config.add_subpackage('io') config.add_subpackage('modalities') config.add_subpackage('utils') - config.add_subpackage('testing') + config.add_subpackage('tests') config.add_subpackage('externals') config.add_subpackage('testing') diff --git a/nipy/tests/__init__.py b/nipy/tests/__init__.py new file mode 100644 index 0000000000..48730efae4 --- /dev/null +++ b/nipy/tests/__init__.py @@ -0,0 +1 @@ +#init for nipy/tests diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py new file mode 100644 index 0000000000..6b6a7d1795 --- /dev/null +++ b/nipy/tests/test_scripts.py @@ -0,0 +1,107 @@ +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +""" Test scripts + +If we appear to be running from the development directory, use the scripts in +the top-level folder ``scripts``. Otherwise try and get the scripts from the +path +""" +from __future__ import with_statement + +import sys +import os +from os.path import dirname, join as pjoin, isfile, isdir, abspath + +from subprocess import Popen, PIPE + +from nibabel.tmpdirs import InTemporaryDirectory + +from nipy import load_image + +from nose.tools import assert_true, assert_false, assert_equal + +from ..testing import funcfile +from numpy.testing import decorators, assert_almost_equal + +from nibabel.optpkg import optional_package + +matplotlib, HAVE_MPL, _ = optional_package('matplotlib') +needs_mpl = decorators.skipif(not HAVE_MPL, "Test needs matplotlib") + +USE_SHELL = os.name != 'nt' + +def local_script_dir(): + # Check for presence of scripts in development directory + below_nipy_dir = abspath(pjoin(dirname(__file__), '..', '..')) + devel_script_dir = pjoin(below_nipy_dir, 'scripts') + if isfile(pjoin(below_nipy_dir, 'setup.py')) and isdir(devel_script_dir): + return devel_script_dir + return None + +LOCAL_SCRIPT_DIR = local_script_dir() + +def run_command(cmd): + if not LOCAL_SCRIPT_DIR is None: + cmd = pjoin(LOCAL_SCRIPT_DIR, cmd) + proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=USE_SHELL) + stdout, stderr = proc.communicate() + if proc.poll() == None: + proc.terminate() + if proc.returncode != 0: + raise RuntimeError('Command "%s" failed with stdout\n%s\nstderr\n%s\n' + % (cmd, stdout, stderr)) + return proc.returncode + + +@needs_mpl +def test_nipy_diagnose(): + # Test nipy diagnose script + fimg = load_image(funcfile) + ncomps = 12 + with InTemporaryDirectory() as tmpdir: + cmd = "nipy_diagnose %s --ncomponents=%d --out-path=%s" % ( + funcfile, ncomps, tmpdir) + run_command(cmd) + for out_fname in ('components_functional.png', + 'pcnt_var_functional.png', + 'tsdiff_functional.png', + 'vectors_components_functional.npz'): + assert_true(isfile(out_fname)) + for out_img in ('max_functional.nii.gz', + 'mean_functional.nii.gz', + 'min_functional.nii.gz', + 'std_functional.nii.gz'): + img = load_image(out_img) + assert_equal(img.shape, fimg.shape[:-1]) + del img + pca_img = load_image('pca_functional.nii.gz') + assert_equal(pca_img.shape, fimg.shape[:-1] + (ncomps,)) + del pca_img + + +@needs_mpl +def test_nipy_tsdiffana(): + # Test nipy_tsdiffana script + out_png = 'ts_out.png' + with InTemporaryDirectory(): + cmd = "nipy_tsdiffana %s --out-file=%s" % (funcfile, out_png) + run_command(cmd) + assert_true(isfile(out_png)) + + +def test_nipy_3_4d(): + # Test nipy_3dto4d and nipy_4dto3d + fimg = load_image(funcfile) + N = fimg.shape[-1] + out_4d = 'func4d.nii' + with InTemporaryDirectory() as tmpdir: + cmd = "nipy_4dto3d %s --out-path=%s" % (funcfile, tmpdir) + run_command(cmd) + imgs_3d = ['functional_%04d.nii' % i for i in range(N)] + for iname in imgs_3d: + assert_true(isfile(iname)) + cmd = "nipy_3dto4d %s --out-4d=%s" % (" ".join(imgs_3d), out_4d) + run_command(cmd) + fimg_back = load_image(out_4d) + assert_almost_equal(fimg.get_data(), fimg_back.get_data()) + del fimg_back From cfd81d96851eb03a89120be31c5366a630eea697 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 22:29:51 -0500 Subject: [PATCH 062/164] BF: fix misspelled import of nibabel The script appears to have been broken for a long time... Tests are good. --- scripts/nipy_4dto3d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/nipy_4dto3d b/scripts/nipy_4dto3d index 962f303498..856c2bf6eb 100755 --- a/scripts/nipy_4dto3d +++ b/scripts/nipy_4dto3d @@ -7,7 +7,7 @@ analyze, MINC, at the moment, as nifti 3D files ''' import os import nipy.externals.argparse as argparse -import nibael as nib +import nibabel as nib def main(): From ae7d234058ba5dec3e4be17c02066021e6852357 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 22:32:13 -0500 Subject: [PATCH 063/164] RF: refactor scripts to extend arguments and help Add more help and command line arguments. Make tsdiffana work better without a screen. --- scripts/nipy_3dto4d | 23 ++++++++++++++--------- scripts/nipy_4dto3d | 33 ++++++++++++++++++++------------- scripts/nipy_tsdiffana | 6 +++++- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/scripts/nipy_3dto4d b/scripts/nipy_3dto4d index f95fd25a88..ab374c8f90 100755 --- a/scripts/nipy_3dto4d +++ b/scripts/nipy_3dto4d @@ -1,13 +1,20 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -''' Tiny script to write 4D file in any format that we write (nifti, -analyze, at the moment, from input 3d files ''' +DESCRIP = 'Read 3D image files and write a 4D file' +EPILOG = \ +'''nipy_3dto4d will take a series of 3D nifti images in any format readable by +nibabel and concatenate them into a 4D image, and write the image with format +guessed from the output image filename. You can set the filename with the +``--out-4d`` parameter, or we make a filename from the input names. +''' import os from os.path import join as pjoin -import nipy.externals.argparse as argparse +from nipy.externals.argparse import (ArgumentParser, + RawDescriptionHelpFormatter) + import nibabel as nib @@ -20,11 +27,11 @@ def do_3d_to_4d(filenames, check_affines=True): def main(): - # create the parser - parser = argparse.ArgumentParser() - # add the arguments + parser = ArgumentParser(description=DESCRIP, + epilog=EPILOG, + formatter_class=RawDescriptionHelpFormatter) parser.add_argument('in_filenames', type=str, - nargs='+', + nargs='+', help='3D image filenames') parser.add_argument('--out-4d', type=str, help='4D output image name') @@ -57,5 +64,3 @@ def main(): if __name__ == '__main__': main() - - diff --git a/scripts/nipy_4dto3d b/scripts/nipy_4dto3d index 856c2bf6eb..cca141552b 100755 --- a/scripts/nipy_4dto3d +++ b/scripts/nipy_4dto3d @@ -1,28 +1,37 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -''' Tiny script to write 4D files in any format that we read (nifti, -analyze, MINC, at the moment, as nifti 3D files ''' +DESCRIP = 'Read 4D image file and write 3D nifti file for each volume' +EPILOG = \ +'''nipy_4dto3d will generate a series of 3D nifti images for each volume a 4D +image series in any format readable by `nibabel`. +''' +from os.path import splitext, join as pjoin, split as psplit -import os - -import nipy.externals.argparse as argparse import nibabel as nib +from nipy.externals.argparse import (ArgumentParser, + RawDescriptionHelpFormatter) + def main(): - # create the parser - parser = argparse.ArgumentParser() - # add the arguments + parser = ArgumentParser(description=DESCRIP, + epilog=EPILOG, + formatter_class=RawDescriptionHelpFormatter) parser.add_argument('filename', type=str, help='4D image filename') - # parse the command line + parser.add_argument('--out-path', type=str, + help='path for output image files') args = parser.parse_args() + out_path = args.out_path img = nib.load(args.filename) imgs = nib.four_to_three(img) - froot, ext = os.path.splitext(args.filename) + froot, ext = splitext(args.filename) if ext in ('.gz', '.bz2'): - froot, ext = os.path.splitext(froot) + froot, ext = splitext(froot) + if not out_path is None: + pth, fname = psplit(froot) + froot = pjoin(out_path, fname) for i, img3d in enumerate(imgs): fname3d = '%s_%04d.nii' % (froot, i) nib.save(img3d, fname3d) @@ -30,5 +39,3 @@ def main(): if __name__ == '__main__': main() - - diff --git a/scripts/nipy_tsdiffana b/scripts/nipy_tsdiffana index 019c59010f..c904d54157 100755 --- a/scripts/nipy_tsdiffana +++ b/scripts/nipy_tsdiffana @@ -4,7 +4,6 @@ ''' Analyze, plot time series difference metrics''' import nipy.externals.argparse as argparse -import nipy.algorithms.diagnostics as nad def main(): @@ -19,6 +18,11 @@ def main(): # parse the command line args = parser.parse_args() show = args.out_file is None + if not show: + import matplotlib + matplotlib.use('Agg') + # Import late to allow setting Agg backend + import nipy.algorithms.diagnostics as nad axes = nad.plot_tsdiffs_image(args.filename, show=show) if args.out_file: axes[0].figure.savefig(args.out_file) From 268764344cbd00fe4a12a2c4a12126564f69d40b Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 17:26:49 -0500 Subject: [PATCH 064/164] NF: setup helper for windows executable scripts Now we have tests for the scripts, I finally find out that the scripts weren't executable on Windows using the default install. Add a distutils hack adapted from Twisted / IPython to make the installed scripts executable from the Windows command line. --- setup_helpers.py | 82 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75 insertions(+), 7 deletions(-) diff --git a/setup_helpers.py b/setup_helpers.py index 3af03bdbca..4fd5a40aaf 100755 --- a/setup_helpers.py +++ b/setup_helpers.py @@ -11,16 +11,19 @@ This module has to work for python 2 and python 3. """ +from __future__ import with_statement # Standard library imports import sys import os -from os.path import join as pjoin, dirname +from os.path import join as pjoin, dirname, isfile import zipfile import warnings import shutil +import re from distutils.cmd import Command from distutils.command.clean import clean +from distutils.command.install_scripts import install_scripts from distutils.version import LooseVersion from distutils.dep_util import newer_group from distutils.errors import DistutilsError @@ -244,12 +247,6 @@ def find_modules(self): # End of numpy.distutils.command.build_py.py copy -# The command classes for distutils, used by setup.py -cmdclass = {'api_docs': APIDocs, - 'clean': Clean, - 'build_sphinx': MyBuildDoc} - - def have_good_cython(): try: from Cython.Compiler.Version import version @@ -301,3 +298,74 @@ def generate_a_pyrex_source(self, base, ext_name, source, extension): " but not available" % (CYTHON_MIN_VERSION, source)) return target_file + +EXE_MATCH_RE = re.compile('^#!.*python[0-9.]*', re.IGNORECASE) + +class install_scripts_nipy(install_scripts): + """ Make scripts executable on Windows + + Scripts are bare file names without extension on Unix, fitting (for example) + Debian rules. They identify as python scripts with the usual ``#!`` first + line. This doesn't work on Windows. So, on Windows only we: + + * Add a ``.py`` extension to the ``bare_script_name`` to select interpeter + by extension + * Add a ``.bat`` wrapper of name ``bare_script_name.bat`` to call + ``bare_script_name.py`` using the python interpreter. + + Notes + ----- + The idea for this routine came from an idea in Twisted, re-used in IPython + + An alternative to this method would be to use the ``distribute`` / + ``setuptools`` ``cli.exe`` method, where we copy a pre-compiled Windows + executable ``cli.exe`` as ``bare_script_name.exe``, and the script as + ``bare_script_name-script.py``. The executable file ``cli.exe`` (copied as + ``bare_script_name.exe``) analyzes its own name, and then calls + ``bare_script_name-script.py`` with the Python interpreter named in the top + line of the script file. But, ``.bat`` wrappers as here seem to work on all + current versions of Windows, are simpler to understand, and don't require + putting pre-compiled code into the repository. + """ + def run(self): + install_scripts.run(self) + if not os.name == "nt": + return + for file in self.get_outputs(): + # rename script to .py so it can be executed on windows + if file.endswith(".py"): + # Only do this processing on the bare scripts, not .py scripts. + continue + log.info("Adding .py extension to %s", file) + py_file = file + '.py' + if self.dry_run: + continue + if isfile(py_file): + os.unlink(py_file) + os.rename(file, py_file) + # If we can find an executable name in the #! top line of the script + # file, make .bat wrapper for .py script, using this executable + # name. The original name has been replaced by one specific to the + # platform during the build_script distutils step. + with open(py_file, 'rt') as fobj: + first_line = fobj.readline() + exe_match = EXE_MATCH_RE.match(first_line) + if exe_match is None: + log.info("No #!python executable found, skipping .bat " + "wrapper") + continue + exe_stuff = first_line[2:].strip() + log.info("Making .bat wrapper for %s with executable %s", + py_file, exe_stuff) + bat_file = file + '.bat' + if isfile(bat_file): + os.unlink(bat_file) + with open(bat_file, 'wt') as fobj: + fobj.write('@"%s" "%s"' % (exe_stuff, py_file) + " %*\n") + + +# The command classes for distutils, used by setup.py +cmdclass = {'api_docs': APIDocs, + 'clean': Clean, + 'build_sphinx': MyBuildDoc, + 'install_scripts': install_scripts_nipy} From eafd6a327da6d7311a4dc2d98d19b44d74103c35 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 23:04:20 -0500 Subject: [PATCH 065/164] RF: run local script files through Python On Windows, we can't run the local files through the shell because they don't have needed ``.bat`` or ``.py`` extension. On Posix, we might have the wrong Python interpreter named on the first line - for example - "#!/usr/bin/env python" won't necessarily work for every platform, and might not be the Python we're interested in. So, run the scripts through the interpreter we're running in already, if the scripts are from the source. --- nipy/tests/test_scripts.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index 6b6a7d1795..f5a2bf9a07 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -42,7 +42,12 @@ def local_script_dir(): def run_command(cmd): if not LOCAL_SCRIPT_DIR is None: - cmd = pjoin(LOCAL_SCRIPT_DIR, cmd) + # Windows can't run script files without extensions natively so we need + # to run local scripts (no extensions) via the Python interpreter. On + # Unix, we might have the wrong incantation for the Python interpreter + # in the hash bang first line in the source file. So, either way, run + # the script through the Python interpreter + cmd = "%s %s" % (sys.executable, pjoin(LOCAL_SCRIPT_DIR, cmd)) proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=USE_SHELL) stdout, stderr = proc.communicate() if proc.poll() == None: From 6fc6809e99a1c68d5f86349fc6d913aee752c4df Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 19:14:37 -0500 Subject: [PATCH 066/164] BF: deal with spaces in paths for script arguments Windows temporary directory names revealed the problem. --- nipy/tests/test_scripts.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index f5a2bf9a07..3c769730e2 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -64,7 +64,8 @@ def test_nipy_diagnose(): fimg = load_image(funcfile) ncomps = 12 with InTemporaryDirectory() as tmpdir: - cmd = "nipy_diagnose %s --ncomponents=%d --out-path=%s" % ( + # Need to quote out path in case it has spaces + cmd = 'nipy_diagnose "%s" --ncomponents=%d --out-path="%s"' % ( funcfile, ncomps, tmpdir) run_command(cmd) for out_fname in ('components_functional.png', @@ -89,7 +90,8 @@ def test_nipy_tsdiffana(): # Test nipy_tsdiffana script out_png = 'ts_out.png' with InTemporaryDirectory(): - cmd = "nipy_tsdiffana %s --out-file=%s" % (funcfile, out_png) + # Quotes in case of space in arguments + cmd = 'nipy_tsdiffana "%s" --out-file="%s"' % (funcfile, out_png) run_command(cmd) assert_true(isfile(out_png)) @@ -100,12 +102,13 @@ def test_nipy_3_4d(): N = fimg.shape[-1] out_4d = 'func4d.nii' with InTemporaryDirectory() as tmpdir: - cmd = "nipy_4dto3d %s --out-path=%s" % (funcfile, tmpdir) + # Quotes in case of space in arguments + cmd = 'nipy_4dto3d "%s" --out-path="%s"' % (funcfile, tmpdir) run_command(cmd) imgs_3d = ['functional_%04d.nii' % i for i in range(N)] for iname in imgs_3d: assert_true(isfile(iname)) - cmd = "nipy_3dto4d %s --out-4d=%s" % (" ".join(imgs_3d), out_4d) + cmd = 'nipy_3dto4d "%s" --out-4d="%s"' % ('" "'.join(imgs_3d), out_4d) run_command(cmd) fimg_back = load_image(out_4d) assert_almost_equal(fimg.get_data(), fimg_back.get_data()) From a91a35437f5bac69f4c0660504718939541c75b3 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 18 Dec 2012 19:38:01 -0500 Subject: [PATCH 067/164] BF: check for symlinks looking for local scripts Common case where we might not have installed the scripts is where we've symlinked the code directory into the path somewhere; check for that case. --- nipy/tests/test_scripts.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index 3c769730e2..55c84c84a0 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -10,7 +10,7 @@ import sys import os -from os.path import dirname, join as pjoin, isfile, isdir, abspath +from os.path import dirname, join as pjoin, isfile, isdir, abspath, realpath from subprocess import Popen, PIPE @@ -31,8 +31,10 @@ USE_SHELL = os.name != 'nt' def local_script_dir(): - # Check for presence of scripts in development directory - below_nipy_dir = abspath(pjoin(dirname(__file__), '..', '..')) + # Check for presence of scripts in development directory. ``realpath`` + # checks for the situation where the development directory has been linked + # into the path. + below_nipy_dir = realpath(pjoin(dirname(__file__), '..', '..')) devel_script_dir = pjoin(below_nipy_dir, 'scripts') if isfile(pjoin(below_nipy_dir, 'setup.py')) and isdir(devel_script_dir): return devel_script_dir From f5848fc25d03b519ea2ea1372d2a9d2205c1b4d8 Mon Sep 17 00:00:00 2001 From: GaelVaroquaux Date: Thu, 20 Dec 2012 13:40:14 +0100 Subject: [PATCH 068/164] BUG: viz: black background in PDF and SVG output --- nipy/labs/viz_tools/activation_maps.py | 8 ++++++++ nipy/labs/viz_tools/test/test_activation_maps.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/nipy/labs/viz_tools/activation_maps.py b/nipy/labs/viz_tools/activation_maps.py index ccd4e5330f..7eb3617e6f 100644 --- a/nipy/labs/viz_tools/activation_maps.py +++ b/nipy/labs/viz_tools/activation_maps.py @@ -268,6 +268,14 @@ def _plot_anat(slicer, anat, anat_affine, title=None, if draw_cross: slicer.draw_cross() + if black_bg: + # To have a black background in PDF, we need to create a + # patch in black for the background + for ax in slicer.axes.values(): + ax.ax.imshow(np.zeros((2, 2, 3)), + extent=[-5000, 5000, -5000, 5000], + zorder=-500) + if title is not None and not title == '': slicer.title(title) return slicer diff --git a/nipy/labs/viz_tools/test/test_activation_maps.py b/nipy/labs/viz_tools/test/test_activation_maps.py index 7b6e333816..0114c1c1aa 100644 --- a/nipy/labs/viz_tools/test/test_activation_maps.py +++ b/nipy/labs/viz_tools/test/test_activation_maps.py @@ -25,6 +25,8 @@ def test_demo_plot_map(): import pylab as pl pl.switch_backend('svg') demo_plot_map() + # Test the black background code path + demo_plot_map(black_bg=True) def test_plot_anat(): From 26dd76d4b4380ec5a4c8e0f61db24f0616b7cd3c Mon Sep 17 00:00:00 2001 From: Gael Varoquaux Date: Mon, 24 Dec 2012 09:12:57 +0100 Subject: [PATCH 069/164] Remove trailing print --- nipy/labs/viz_tools/slicers.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nipy/labs/viz_tools/slicers.py b/nipy/labs/viz_tools/slicers.py index 5103a96ed3..a7fa5bc4f4 100644 --- a/nipy/labs/viz_tools/slicers.py +++ b/nipy/labs/viz_tools/slicers.py @@ -671,7 +671,6 @@ def _locator(self, axes, renderer): left_dict[cut_ax.ax] = left this_width = width_dict[cut_ax.ax] left += this_width - print len(width_dict), left_dict[axes] + width_dict[axes] return transforms.Bbox([[left_dict[axes], y0], [left_dict[axes] + width_dict[axes], y1]]) From 0a9e3af7953531434ef5147c920cab418613f87a Mon Sep 17 00:00:00 2001 From: Gael Varoquaux Date: Mon, 24 Dec 2012 09:21:51 +0100 Subject: [PATCH 070/164] DOC: correct docstring --- nipy/labs/viz_tools/activation_maps.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipy/labs/viz_tools/activation_maps.py b/nipy/labs/viz_tools/activation_maps.py index 7eb3617e6f..64ed6c604d 100644 --- a/nipy/labs/viz_tools/activation_maps.py +++ b/nipy/labs/viz_tools/activation_maps.py @@ -75,7 +75,7 @@ def plot_map(map, affine, cut_coords=None, anat=None, anat_affine=None, figure : integer or matplotlib figure, optional Matplotlib figure used or its number. If None is given, a new figure is created. - axes : matplotlib axes or 4 tuple of float: (xmin, xmax, ymin, ymin), optional + axes : matplotlib axes or 4 tuple of float: (xmin, ymin, width, height), optional The axes, or the coordinates, in matplotlib figure space, of the axes used to display the plot. If None, the complete figure is used. @@ -185,7 +185,7 @@ def plot_map(map, affine, cut_coords=None, anat=None, anat_affine=None, from enthought.mayavi import mlab if threshold_3d is None: threshold_3d = threshold - plot_map_3d(np.asarray(map), affine, cut_coords=cut_coords, + plot_map_3d(np.asarray(map), affine, cut_coords=cut_coords, anat=anat, anat_affine=anat_affine, offscreen=offscreen, cmap=cmap, threshold=threshold_3d, @@ -312,7 +312,7 @@ def plot_anat(anat=None, anat_affine=None, cut_coords=None, slicer='ortho', figure : integer or matplotlib figure, optional Matplotlib figure used or its number. If None is given, a new figure is created. - axes : matplotlib axes or 4 tuple of float: (xmin, xmax, ymin, ymin), optional + axes : matplotlib axes or 4 tuple of float: (xmin, ymin, width, height), optional The axes, or the coordinates, in matplotlib figure space, of the axes used to display the plot. If None, the complete figure is used. From 3f18b0738b13fff1a45d90362a3dee1e8e78941b Mon Sep 17 00:00:00 2001 From: Gael Varoquaux Date: Mon, 24 Dec 2012 09:30:03 +0100 Subject: [PATCH 071/164] ENH: make it easier to use axes in slicers --- nipy/labs/viz_tools/slicers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nipy/labs/viz_tools/slicers.py b/nipy/labs/viz_tools/slicers.py index a7fa5bc4f4..a93a87fa6c 100644 --- a/nipy/labs/viz_tools/slicers.py +++ b/nipy/labs/viz_tools/slicers.py @@ -241,6 +241,8 @@ def init_with_figure(cls, data=None, affine=None, threshold=None, black_bg=False, leave_space=False): cut_coords = cls.find_cut_coords(data, affine, threshold, cut_coords) + if isinstance(axes, pl.Axes) and figure is None: + figure = axes.figure if not isinstance(figure, pl.Figure): # Make sure that we have a figure @@ -264,7 +266,9 @@ def init_with_figure(cls, data=None, affine=None, threshold=None, axes = [0.3, 0, .7, 1.] if operator.isSequenceType(axes): axes = figure.add_axes(axes) - axes.axis('off') + # People forget to turn their axis off, or to set the zorder, and + # then they cannot see their slicer + axes.axis('off') return cls(cut_coords, axes, black_bg) From fceb5d0af5b352cfec3204d45b9c52adf4cd3565 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 26 Dec 2012 10:02:16 +0000 Subject: [PATCH 072/164] DOC+TST: add examples to pca docstrings Add doctests and some commentary to ``pca_image`` and ``pca``. --- nipy/algorithms/utils/pca.py | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/nipy/algorithms/utils/pca.py b/nipy/algorithms/utils/pca.py index fb3e7089c5..ce2cd126fd 100644 --- a/nipy/algorithms/utils/pca.py +++ b/nipy/algorithms/utils/pca.py @@ -90,6 +90,28 @@ def pca(data, axis=0, mask=None, ncomp=None, standardize=True, See: http://en.wikipedia.org/wiki/Principal_component_analysis for some inspiration for naming - particularly 'basis_vectors' and 'basis_projections' + + Examples + -------- + >>> arr = np.random.normal(size=(17, 10, 12, 14)) + >>> msk = np.all(arr > -2, axis=0) + >>> res = pca(arr, mask=msk, ncomp=9) + + Basis vectors are columns. There is one column for each component. The + number of components is the calculated rank of the data matrix after + applying the various projections listed in the parameters. In this case we + are only removing the mean, so the number of components is one less than the + axis over which we do the PCA (here axis=0 by default). + + >>> res['basis_vectors'].shape + (17, 16) + + Basis projections are arrays with components in the dimension over which we + have done the PCA (axis=0 by default). Because we set `ncomp` above, we + only retain `ncomp` components. + + >>> res['basis_projections'].shape + (9, 10, 12, 14) """ data = np.asarray(data) # We roll the PCA axis to be first, for convenience @@ -277,6 +299,30 @@ def pca_image(img, axis='t', mask=None, ncomp=None, standardize=True, over axis `axis`; thus shape given by: ``s = list(data.shape); s[axis] = ncomp`` * ``axis``: axis over which PCA has been performed. + + Examples + -------- + >>> from nipy.testing import funcfile + >>> from nipy import load_image + >>> func_img = load_image(funcfile) + + Time is the fourth axis + + >>> func_img.coordmap.function_range + CoordinateSystem(coord_names=('aligned-x=L->R', 'aligned-y=P->A', 'aligned-z=I->S', 't'), name='aligned', coord_dtype=float64) + >>> func_img.shape + (17, 21, 3, 20) + + Calculate the PCA over time, by default + + >>> res = pca_image(func_img) + >>> res['basis_projections'].coordmap.function_range + CoordinateSystem(coord_names=('aligned-x=L->R', 'aligned-y=P->A', 'aligned-z=I->S', 'PCA components'), name='aligned', coord_dtype=float64) + + The number of components is one less than the number of time points + + >>> res['basis_projections'].shape + (17, 21, 3, 19) """ img_klass = img.__class__ # Which axes are we operating over? From e2672383111f5a04f757004ce16666634e84e767 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 13 Nov 2012 10:35:20 +0100 Subject: [PATCH 073/164] NF: added a module to handle mixed-effects --- .../statistics/mixed_effects_stat.py | 395 ++++++++++++++++++ 1 file changed, 395 insertions(+) create mode 100644 nipy/algorithms/statistics/mixed_effects_stat.py diff --git a/nipy/algorithms/statistics/mixed_effects_stat.py b/nipy/algorithms/statistics/mixed_effects_stat.py new file mode 100644 index 0000000000..fa764f4e13 --- /dev/null +++ b/nipy/algorithms/statistics/mixed_effects_stat.py @@ -0,0 +1,395 @@ +""" +Module for computation of mixed effects statistics with an EM algorithm. +i.e. +solves problems of the form +y = X beta + e1 + e2, +where X and Y are known, e1 and e2 are centered with diagonal covariance. +V1 = var(e1) is known, and V2 = var(e2) = lambda identity. +the code estimates beta and lambda using an EM algorithm. +Likelihood ratio tests can then be used to test the columns of beta. + +Author: Bertrand Thirion, 2012. + +>>> N, P = 15, 500 +>>> V1 = np.random.randn(N, P) ** 2 +>>> effects = np.random.randn(P) > 0 +>>> Y = generate_data(np.ones(N), effects, .25, V1) +>>> T1 = one_sample_ttest(Y, V1, n_iter=5) +>>> T1 = [T1[effects == x] for x in np.unique(effects)] +>>> T2 = [t_stat(Y)[effects == x] for x in np.unique(effects)] +>>> import matplotlib.pyplot as plt +>>> AX = plt.figure().add_subplot(111) +>>> AX.boxplot(T1, positions=[-0.1, .9]) +>>> AX.boxplot(T2, positions=[0.1, 1.1]) +>>> AX.set_xticks([0, 1]) +>>> AX.set_xlabel('simulated effects') +>>> AX.set_ylabel('decision statistic') +>>> AX.set_title('left: mixed effects model, right: standard t test') +>>> plt.show() +""" + +import numpy as np + +EPS = 100 * np.finfo(float).eps + + +def generate_data(X, beta, V2, V1): + """ Generate a group of individuals from the provided parameters + + Parameters + ---------- + X: array of shape (n_samples, n_reg), + the design matrix of the model + beta: float or array of shape (n_reg, n_tests), + the associated effects + V2: float or array of shape (n_tests), + group variance + V1: array of shape(n_samples, n_tests), + the individual variances + + Returns + ------- + Y: array of shape(n_samples, n_tests) + the individual data related to the two-level normal model + """ + # check that the variances are positive + if (V1 < 0).any(): + raise ValueError('Variance should be positive') + Y = np.random.randn(*V1.shape) + Y *= np.sqrt(V2 + V1) + if X.ndim == 1: + X = X[:, np.newaxis] + if np.isscalar(beta): + beta = beta * np.ones((X.shape[1], V1.shape[1])) + if beta.ndim == 1: + beta = beta[np.newaxis] + + Y += np.dot(X, beta) + return Y + + +def check_arrays(Y, V1): + """Check that the given data can be used for the models + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) or (n_samples) + the estimated effects + V1: array of shape (n_samples, n_tests) or (n_samples) + first-level variance + """ + if (V1 < 0).any(): + raise ValueError("a negative variance has been provided") + + if np.size(Y) == Y.shape[0]: + Y = Y[:, np.newaxis] + + if np.size(V1) == V1.shape[0]: + V1 = V1[:, np.newaxis] + + if Y.shape != V1.shape: + raise ValueError("Y and V1 do not have the same shape") + return Y, V1 + + +def t_stat(Y): + """ Returns the t stat of the sample on each row of the matrix + + Parameters + ---------- + Y, array of shape (n_samples, n_tests) + + Returns + ------- + t_variates, array of shape (n_tests) + """ + return Y.mean(0) / Y.std(0) * np.sqrt(Y.shape[0] - 1) + + +class MixedEffectsModel(object): + """Class to handle multiple one-sample mixed effects models + """ + + def __init__(self, X, n_iter=5, verbose=False): + """ + Set the effects and first-level variance, + and initialize related quantities + + Parameters + ---------- + X: array of shape(n_samples, n_effects), + the design matrix + n_iter: int, optional, + number of iterations of the EM algorithm + verbose: bool, optional, verbosity mode + """ + self.n_iter = n_iter + self.verbose = verbose + self.X = X + self.pinv_X = np.linalg.pinv(X) + + def log_like(self, Y, V1): + """ Compute the log-likelihood of (Y, V1) under the model + + Parameters + ---------- + Y, array of shape (n_samples, n_tests) or (n_samples) + the estimated effects + V1, array of shape (n_samples, n_tests) or (n_samples) + first-level variance + + Returns + ------- + logl: array of shape self.n_tests, + the log-likelihood of the model + """ + Y, V1 = check_arrays(Y, V1) + tvar = self.V2 + V1 + logl = np.sum(((Y - self.Y_) ** 2) / tvar, 0) + logl += np.sum(np.log(tvar), 0) + logl += np.log(2 * np.pi) * Y.shape[0] + logl *= (- 0.5) + return logl + + def predict(self, Y, V1): + """Return the log_likelihood of the data.See the log_like method""" + return self.log_like(Y, V1) + + def score(self, Y, V1): + """Return the log_likelihood of the data. See the log_like method""" + return self.log_like(Y, V1) + + def _one_step(self, Y, V1): + """Applies one step of an EM algorithm to estimate self.mean_, self.var + + Parameters + ---------- + Y, array of shape (n_samples, n_tests) or (n_samples) + the estimated effects + V1, array of shape (n_samples, n_tests) or (n_samples) + first-level variance + """ + # E step + prec = 1. / (self.V2 + V1) + Y_ = prec * (self.V2 * Y + V1 * self.Y_) + cvar = V1 * self.V2 * prec + + # M step + self.beta_ = np.dot(self.pinv_X, Y_) + self.Y_ = np.dot(self.X, self.beta_) + self.V2 = np.mean((Y_ - self.Y_) ** 2, 0) + cvar.mean(0) + + def fit(self, Y, V1): + """ Launches the EM algorithm to estimate self + + Parameters + ---------- + Y, array of shape (n_samples, n_tests) or (n_samples) + the estimated effects + V1, array of shape (n_samples, n_tests) or (n_samples) + first-level variance + + Returns + ------- + self + """ + # Basic data checks + if self.X.shape[0] != Y.shape[0]: + raise ValueError('X and Y must have the same numbers of rows') + Y, V1 = check_arrays(Y, V1) + self.beta_ = np.dot(self.pinv_X, Y) + self.Y_ = np.dot(self.X, self.beta_) + self.V2 = np.mean((Y - self.Y_) ** 2, 0) + + if self.verbose: + log_like_init = self.log_like(Y, V1) + print('Average log-likelihood: ', log_like_init.mean()) + + for i in range(self.n_iter): + self._one_step(Y, V1) + + if self.verbose: + log_like_ = self.log_like(Y, V1) + if (log_like_ < (log_like_init - EPS)).any(): + raise ValueError('The log-likelihood cannot decrease') + log_like_init = log_like_ + print ('Iteration %d, average log-likelihood: %f' % ( + i, log_like_.mean())) + return self + + +def two_sample_ftest(Y, V1, group, n_iter=5, verbose=False): + """Returns the mixed effects t-stat for each row of the X + (one sample test) + This uses the Formula in Roche et al., NeuroImage 2007 + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) + the data + V1: array of shape (n_samples, n_tests) + first-level variance assocated with the data + group: array of shape (n_samples) + a vector of indicators yielding the samples membership + n_iter: int, optional, + number of iterations of the EM algorithm + verbose: bool, optional, verbosity mode + + Returns + ------- + tstat: array of shape (n_tests), + statistical values obtained from the likelihood ratio test + """ + # check that group is correct + if group.size != Y.shape[0]: + raise ValueError('The number of labels is not the number of samples') + if (np.unique(group) != np.array([0, 1])).all(): + raise ValueError('group should be composed only of zeros and ones') + + # create design matrices + X = np.vstack((np.ones_like(group), group)).T + return mfx_stat(Y, V1, X, 1, n_iter=n_iter, verbose=verbose, + return_t=False, return_f=True)[0] + + +def two_sample_ttest(Y, V1, group, n_iter=5, verbose=False): + """Returns the mixed effects t-stat for each row of the X + (one sample test) + This uses the Formula in Roche et al., NeuroImage 2007 + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) + the data + V1: array of shape (n_samples, n_tests) + first-level variance assocated with the data + group: array of shape (n_samples) + a vector of indicators yielding the samples membership + n_iter: int, optional, + number of iterations of the EM algorithm + verbose: bool, optional, verbosity mode + + Returns + ------- + tstat: array of shape (n_tests), + statistical values obtained from the likelihood ratio test + """ + X = np.vstack((np.ones_like(group), group)).T + return mfx_stat(Y, V1, X, 1, n_iter=n_iter, verbose=verbose, + return_t=True)[0] + + +def one_sample_ftest(Y, V1, n_iter=5, verbose=False): + """Returns the mixed effects F-stat for each row of the X + (one sample test) + This uses the Formula in Roche et al., NeuroImage 2007 + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) + the data + V1: array of shape (n_samples, n_tests) + first-level variance ssociated with the data + n_iter: int, optional, + number of iterations of the EM algorithm + verbose: bool, optional, verbosity mode + + Returns + ------- + fstat, array of shape (n_tests), + statistical values obtained from the likelihood ratio test + sign, array of shape (n_tests), + sign of the mean for each test (allow for post-hoc signed tests) + """ + return mfx_stat(Y, V1, np.ones((Y.shape[0], 1)), 0, n_iter=n_iter, + verbose=verbose, return_t=False, return_f=True)[0] + + +def one_sample_ttest(Y, V1, n_iter=5, verbose=False): + """Returns the mixed effects t-stat for each row of the X + (one sample test) + This uses the Formula in Roche et al., NeuroImage 2007 + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) + the observations + V1: array of shape (n_samples, n_tests) + first-level variance associated with the observations + n_iter: int, optional, + number of iterations of the EM algorithm + verbose: bool, optional, verbosity mode + + Returns + ------- + tstat: array of shape (n_tests), + statistical values obtained from the likelihood ratio test + """ + return mfx_stat(Y, V1, np.ones((Y.shape[0], 1)), 0, n_iter=n_iter, + verbose=verbose, return_t=True)[0] + + +def mfx_stat(Y, V1, X, column, n_iter=5, return_t=True, + return_f=False, return_effect=False, + return_var=False, verbose=False): + """Run a mixed-effects model test on the column of the design matrix + + Parameters + ---------- + Y: array of shape (n_samples, n_tests) + the data + V1: array of shape (n_samples, n_tests) + first-level variance assocated with the data + X: array of shape(n_samples, n_regressors) + the design matrix of the model + column: int, + index of the column of X to be tested + n_iter: int, optional, + number of iterations of the EM algorithm + return_t: bool, optional, + should one return the t test (True by default) + return_f: bool, optional, + should one return the F test (False by default) + return_effect: bool, optional, + should one return the effect estimate (False by default) + return_var: bool, optional, + should one return the variance estimate (False by default) + + verbose: bool, optional, verbosity mode + + Returns + ------- + (tstat, fstat, effect, var): tuple of arrays of shape (n_tests), + those required by the input return booleans + + """ + # check that X/columns are correct + column = int(column) + if X.shape[0] != Y.shape[0]: + raise ValueError('X.shape[0] is not the number of samples') + if (column > X.shape[1]): + raise ValueError('the column index is more than the number of columns') + + # create design matrices + contrast_mask = 1 - np.eye(X.shape[1])[column] + X0 = X * contrast_mask + + # instantiate the mixed effects models + model_0 = MixedEffectsModel(X0, n_iter=n_iter, verbose=verbose).fit(Y, V1) + model_1 = MixedEffectsModel(X, n_iter=n_iter, verbose=verbose).fit(Y, V1) + + # compute the log-likelihood ratio statistic + fstat = 2 * (model_1.log_like(Y, V1) - model_0.log_like(Y, V1)) + fstat = np.maximum(0, fstat) + sign = np.sign(model_1.beta_[column]) + + output = () + if return_t: + output += (np.sqrt(fstat) * sign,) + if return_f: + output += (fstat,) + if return_var: + output += (model_1.V2,) + if return_effect: + output += (model_1.beta_[column],) + return output From 50d8722e808898050afe73db0c14e1b6ceb51cfd Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 13 Nov 2012 10:35:54 +0100 Subject: [PATCH 074/164] ENH: added the corresponding tests --- .../statistics/tests/test_mixed_effects.py | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 nipy/algorithms/statistics/tests/test_mixed_effects.py diff --git a/nipy/algorithms/statistics/tests/test_mixed_effects.py b/nipy/algorithms/statistics/tests/test_mixed_effects.py new file mode 100644 index 0000000000..e67982b2c1 --- /dev/null +++ b/nipy/algorithms/statistics/tests/test_mixed_effects.py @@ -0,0 +1,137 @@ +""" Testing the glm module +""" + +import numpy as np +from numpy.testing import assert_almost_equal +from nose.tools import assert_true +import numpy.random as nr + +from ..mixed_effects_stat import ( + one_sample_ttest, one_sample_ftest, two_sample_ttest, two_sample_ftest, + generate_data, t_stat, mfx_stat) + + +def test_mfx(): + """ Test the generic mixed-effects model""" + n_samples, n_tests = 20, 100 + np.random.seed(1) + + # generate some data + V1 = np.random.rand(n_samples, n_tests) + Y = generate_data(np.ones((n_samples, 1)), 0, 1, V1) + X = np.random.randn(20, 3) + + # compute the test statistics + t1, = mfx_stat(Y, V1, X, 1,return_t=True, + return_f=False, return_effect=False, + return_var=False) + assert_true(t1.shape == (n_tests,)) + assert_true(t1.mean() < 5 / np.sqrt(n_tests)) + assert_true((t1.var() < 2) and (t1.var() > .5)) + t2, = mfx_stat(Y, V1, X * np.random.rand(3), 1) + assert_almost_equal(t1, t2) + f, = mfx_stat(Y, V1, X, 1, return_t=False, return_f=True) + assert_almost_equal(t1 ** 2, f) + v2, = mfx_stat(Y, V1, X, 1, return_t=False, return_var=True) + assert_true((v2 > 0).all()) + fx, = mfx_stat(Y, V1, X, 1, return_t=False, return_effect=True) + assert_true(fx.shape == (n_tests,)) + +def test_t_test(): + """ test that the t test run + """ + n_samples, n_tests = 15, 100 + data = nr.randn(n_samples, n_tests) + t = t_stat(data) + assert_true(t.shape == (n_tests,)) + assert_true( np.abs(t.mean() < 5 / np.sqrt(n_tests))) + assert_true(t.var() < 2) + assert_true( t.var() > .5) + +def test_two_sample_ttest(): + """ test that the mfx ttest indeed runs + """ + n_samples, n_tests = 15, 4 + np.random.seed(1) + + # generate some data + vardata = np.random.rand(n_samples, n_tests) + data = generate_data(np.ones(n_samples), 0, 1, vardata) + + # compute the test statistics + u = np.concatenate((np.ones(5), np.zeros(10))) + t2 = two_sample_ttest(data, vardata, u, n_iter=5) + assert t2.shape == (n_tests,) + assert np.abs(t2.mean() < 5 / np.sqrt(n_tests)) + assert t2.var() < 2 + assert t2.var() > .5 + + # try verbose mode + t3 = two_sample_ttest(data, vardata, u, n_iter=5, verbose=1) + assert_almost_equal(t2, t3) + +def test_two_sample_ftest(): + """ test that the mfx ttest indeed runs + """ + n_samples, n_tests = 15, 4 + np.random.seed(1) + + # generate some data + vardata = np.random.rand(n_samples, n_tests) + data = generate_data(np.ones((n_samples, 1)), 0, 1, vardata) + + # compute the test statistics + u = np.concatenate((np.ones(5), np.zeros(10))) + t2 = two_sample_ftest(data, vardata, u, n_iter=5) + assert t2.shape == (n_tests,) + assert np.abs(t2.mean() < 5 / np.sqrt(n_tests)) + assert t2.var() < 2 + assert t2.var() > .5 + + # try verbose mode + t3 = two_sample_ftest(data, vardata, u, n_iter=5, verbose=1) + assert_almost_equal(t2, t3) + +def test_mfx_ttest(): + """ test that the mfx ttest indeed runs + """ + n_samples, n_tests = 15, 100 + np.random.seed(1) + + # generate some data + vardata = np.random.rand(n_samples, n_tests) + data = generate_data(np.ones((n_samples, 1)), 0, 1, vardata) + + # compute the test statistics + t2 = one_sample_ttest(data, vardata, n_iter=5) + assert t2.shape == (n_tests,) + assert np.abs(t2.mean() < 5 / np.sqrt(n_tests)) + assert t2.var() < 2 + assert t2.var() > .5 + + # try verbose mode + t3 = one_sample_ttest(data, vardata, n_iter=5, verbose=1) + assert_almost_equal(t2, t3) + +def test_mfx_ftest(): + """ test that the mfx ftest indeed runs + """ + n_samples, n_tests = 15, 100 + np.random.seed(1) + + # generate some data + vardata = np.random.rand(n_samples, n_tests) + data = generate_data(np.ones((n_samples, 1)), 0, 1, vardata) + + # compute the test statistics + f = one_sample_ftest(data, vardata, n_iter=5) + assert f.shape == (n_tests,) + assert (np.abs(f.mean() - 1) < 1) + assert f.var() < 10 + assert f.var() > .2 + + +if __name__ == "__main__": + import nose + nose.run(argv=['', __file__]) + From ed416b6f9b5584c3f1832cf66e209236dd9ef9d0 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 13 Nov 2012 10:59:09 +0100 Subject: [PATCH 075/164] ENH: Added an example illustrating the impact of mixed-effects model --- examples/algorithms/mixed_effects.py | 56 ++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 examples/algorithms/mixed_effects.py diff --git a/examples/algorithms/mixed_effects.py b/examples/algorithms/mixed_effects.py new file mode 100644 index 0000000000..ce1a94900e --- /dev/null +++ b/examples/algorithms/mixed_effects.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +""" +This example illustrates the impact of using a mixed-effects model +for the detection of the effects, when the first-level variance is known: +If the first level variance is very variable across observations, then taking +it into account gives more relibale detections, as seen in an ROC curve. + +Requires matplotlib. + +Author: Bertrand Thirion, 2012 +""" +print __doc__ + +import numpy as np +import matplotlib.pyplot as plt + +from nipy.algorithms.statistics.mixed_effects_stat import ( + generate_data, one_sample_ttest, t_stat) + +# generate the data +N, P = 15, 500 +V1 = np.random.randn(N, P) ** 2 +effects = 0.5 * (np.random.randn(P) > 0) +Y = generate_data(np.ones(N), effects, .25, V1) + +# compute the statistics +T1 = one_sample_ttest(Y, V1, n_iter=5) +T1 = [T1[effects == x] for x in np.unique(effects)] +T2 = [t_stat(Y)[effects == x] for x in np.unique(effects)] + +# Derive ROC curves +ROC1 = np.array([np.sum(T1[1] > - x) for x in np.sort(- T1[0])])\ + * 1. / T1[1].size +ROC2 = np.array([np.sum(T2[1] > - x) for x in np.sort(- T2[0])])\ + * 1. / T1[1].size + +# make a figure +FIG = plt.figure(figsize=(10, 5)) +AX = FIG.add_subplot(121) +AX.plot(np.linspace(0, 1, len(ROC1)), ROC1, label='mixed effects') +AX.plot(np.linspace(0, 1, len(ROC2)), ROC2, label='t test') +AX.set_xlabel('false positives') +AX.set_ylabel('true positives') +AX.set_title('ROC curves for the detection of effects', fontsize=12) +AX.legend(loc='lower right') +AX = FIG.add_subplot(122) +AX.boxplot(T1, positions=[-0.1, .9]) +AX.boxplot(T2, positions=[0.1, 1.1]) +AX.set_xticks([0, 1]) +AX.set_xlabel('simulated effects') +AX.set_ylabel('decision statistic') +AX.set_title('left: mixed effects model, \n right: standard t test', + fontsize=12) +plt.show() From 65e0de480d9ec16cd5eabf74e4fe9184613740ee Mon Sep 17 00:00:00 2001 From: bthirion Date: Thu, 15 Nov 2012 14:59:40 +0100 Subject: [PATCH 076/164] BF: Changed the mixed-effects doctest for Travis --- nipy/algorithms/statistics/mixed_effects_stat.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/nipy/algorithms/statistics/mixed_effects_stat.py b/nipy/algorithms/statistics/mixed_effects_stat.py index fa764f4e13..709e064bf6 100644 --- a/nipy/algorithms/statistics/mixed_effects_stat.py +++ b/nipy/algorithms/statistics/mixed_effects_stat.py @@ -17,15 +17,8 @@ >>> T1 = one_sample_ttest(Y, V1, n_iter=5) >>> T1 = [T1[effects == x] for x in np.unique(effects)] >>> T2 = [t_stat(Y)[effects == x] for x in np.unique(effects)] ->>> import matplotlib.pyplot as plt ->>> AX = plt.figure().add_subplot(111) ->>> AX.boxplot(T1, positions=[-0.1, .9]) ->>> AX.boxplot(T2, positions=[0.1, 1.1]) ->>> AX.set_xticks([0, 1]) ->>> AX.set_xlabel('simulated effects') ->>> AX.set_ylabel('decision statistic') ->>> AX.set_title('left: mixed effects model, right: standard t test') ->>> plt.show() +>>> print "Standard deviation of the mfx statistic:", [t1.std() for t1 in T1] +>>> print "Standard deviation of student t test:", [t2.std() for t2 in T2] """ import numpy as np From d3a6478634c9deefaffea20748c43d6671bb73d9 Mon Sep 17 00:00:00 2001 From: bthirion Date: Thu, 15 Nov 2012 23:13:26 +0100 Subject: [PATCH 077/164] BF: Changed the mixed-effects doctest for Travis -- again --- nipy/algorithms/statistics/mixed_effects_stat.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nipy/algorithms/statistics/mixed_effects_stat.py b/nipy/algorithms/statistics/mixed_effects_stat.py index 709e064bf6..1dfb86cce7 100644 --- a/nipy/algorithms/statistics/mixed_effects_stat.py +++ b/nipy/algorithms/statistics/mixed_effects_stat.py @@ -17,8 +17,7 @@ >>> T1 = one_sample_ttest(Y, V1, n_iter=5) >>> T1 = [T1[effects == x] for x in np.unique(effects)] >>> T2 = [t_stat(Y)[effects == x] for x in np.unique(effects)] ->>> print "Standard deviation of the mfx statistic:", [t1.std() for t1 in T1] ->>> print "Standard deviation of student t test:", [t2.std() for t2 in T2] +>>> assert np.array([t1.std() < t2.std() for t1, t2 in zip(T1, T2)]).all() """ import numpy as np From b040e9bfcd1f6e14b384ac447284de8bc7d54de0 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 31 Dec 2012 13:53:52 +0000 Subject: [PATCH 078/164] RF: add debug print for script tests Debug print tells us which command got run for debugging; we need to know whether we're picking up the scripts on the path or the ones in the development directory. --- nipy/tests/test_scripts.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index 55c84c84a0..8c5da088b9 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -30,6 +30,8 @@ USE_SHELL = os.name != 'nt' +DEBUG_PRINT = True + def local_script_dir(): # Check for presence of scripts in development directory. ``realpath`` # checks for the situation where the development directory has been linked @@ -50,6 +52,8 @@ def run_command(cmd): # in the hash bang first line in the source file. So, either way, run # the script through the Python interpreter cmd = "%s %s" % (sys.executable, pjoin(LOCAL_SCRIPT_DIR, cmd)) + if DEBUG_PRINT: + print("Running command '%s'" % cmd) proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=USE_SHELL) stdout, stderr = proc.communicate() if proc.poll() == None: From 019cb2986e902bf36bc5c1ed1dd4b612f288b0f5 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 3 Jan 2013 18:09:27 +0000 Subject: [PATCH 079/164] RF: add bdist_mpkg to setuptools command list We might be using bdist_mpkg for making mpkg installers on OSX. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b0051b7dc9..57204cd825 100755 --- a/setup.py +++ b/setup.py @@ -49,8 +49,9 @@ def configuration(parent_package='',top_path=None): ################################################################################ # For some commands, use setuptools -if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', +if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', + 'bdist_mpkg', )).intersection(sys.argv)) > 0: from setup_egg import extra_setuptools_args From 2a78fef250860564d47d4bbdfb4ddae05edc5297 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 4 Jan 2013 17:08:22 +0000 Subject: [PATCH 080/164] RF: get DEBUG_PRINT from environment From Yarik's suggestion. --- nipy/tests/test_scripts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index 8c5da088b9..99231d6dea 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -30,7 +30,7 @@ USE_SHELL = os.name != 'nt' -DEBUG_PRINT = True +DEBUG_PRINT = os.environ.get('NIPY_DEBUG_PRINT', False) def local_script_dir(): # Check for presence of scripts in development directory. ``realpath`` From ed774d345c87052a2ef3970346a2cc835abf1b22 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 25 Dec 2012 22:41:19 +0100 Subject: [PATCH 081/164] COSMIT: nicer vizualization example --- examples/labs/need_data/viz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/labs/need_data/viz.py b/examples/labs/need_data/viz.py index 1ecd0accbb..e8722bfaa8 100644 --- a/examples/labs/need_data/viz.py +++ b/examples/labs/need_data/viz.py @@ -39,15 +39,15 @@ anat_affine = None viz.plot_map(data, affine, anat=anat, anat_affine=anat_affine, - slicer='z', threshold=2, cmap=viz.cm.cold_hot) + slicer='z', threshold=2, cmap=viz.cm.cold_hot, black_bg=True) pl.savefig('z_view.png') viz.plot_map(data, affine, anat=anat, anat_affine=anat_affine, - slicer='x', threshold=2, cmap=viz.cm.cold_hot) + slicer='x', threshold=2, cmap=viz.cm.cold_hot, black_bg=True) pl.savefig('x_view.png') viz.plot_map(data, affine, anat=anat, anat_affine=anat_affine, - slicer='y', threshold=2, cmap=viz.cm.cold_hot) + slicer='y', threshold=2, cmap=viz.cm.cold_hot, black_bg=True) pl.savefig('y_view.png') pl.show() From 58b547ec99c9a4b9e01d601f8c1269dc217be0ce Mon Sep 17 00:00:00 2001 From: Gael Varoquaux Date: Wed, 9 Jan 2013 22:42:06 +0100 Subject: [PATCH 082/164] MISC: remove transparency Using transparency is a bad idea because if you save as figures as PDFs, the corresponding PDFs will rely on transparency in PDF which cannot be translated to EPS (EPS does not have the notion of transparency). As a result, publishers like Elsevier will rasterize the figure, often in a very crude way. People keep getting bitten by this effect. It is better to change the defaults. --- nipy/labs/viz_tools/slicers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nipy/labs/viz_tools/slicers.py b/nipy/labs/viz_tools/slicers.py index a93a87fa6c..d17d1c5647 100644 --- a/nipy/labs/viz_tools/slicers.py +++ b/nipy/labs/viz_tools/slicers.py @@ -164,7 +164,7 @@ def draw_left_right(self, size, bg_color, **kwargs): verticalalignment='top', size=size, bbox=dict(boxstyle="square,pad=0", - ec=bg_color, fc=bg_color, alpha=.8), + ec=bg_color, fc=bg_color, alpha=1), **kwargs) ax.text(.9, .95, 'R', @@ -173,7 +173,7 @@ def draw_left_right(self, size, bg_color, **kwargs): verticalalignment='top', size=size, bbox=dict(boxstyle="square,pad=0", - ec=bg_color, fc=bg_color, alpha=.8), + ec=bg_color, fc=bg_color, alpha=1), **kwargs) @@ -185,7 +185,7 @@ def draw_position(self, size, bg_color, **kwargs): verticalalignment='bottom', size=size, bbox=dict(boxstyle="square,pad=0", - ec=bg_color, fc=bg_color, alpha=.9), + ec=bg_color, fc=bg_color, alpha=1), **kwargs) @@ -273,7 +273,7 @@ def init_with_figure(cls, data=None, affine=None, threshold=None, def title(self, text, x=0.01, y=0.99, size=15, color=None, - bgcolor=None, alpha=.9, **kwargs): + bgcolor=None, alpha=1, **kwargs): """ Write a title to the view. Parameters From 667e0d682e657350b932dfa513a3c0581faa0d39 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 9 Jan 2013 22:42:18 +0000 Subject: [PATCH 083/164] DOC: fix typos in visualize --- examples/labs/need_data/plot_registration.py | 2 +- examples/labs/need_data/viz.py | 2 +- nipy/algorithms/clustering/ggmixture.py | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/labs/need_data/plot_registration.py b/examples/labs/need_data/plot_registration.py index a0b0928b30..375fcdc0d9 100755 --- a/examples/labs/need_data/plot_registration.py +++ b/examples/labs/need_data/plot_registration.py @@ -3,7 +3,7 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility __doc__ = """ -Example of plotting a registration checker with nipy.labs vizualization tools +Example of plotting a registration checker with nipy.labs visualization tools The idea is to represent the anatomical image to be checked with an overlay of the edges of the reference image. This idea is borrowed from FSL. diff --git a/examples/labs/need_data/viz.py b/examples/labs/need_data/viz.py index b398e17b1c..b468c8cc31 100755 --- a/examples/labs/need_data/viz.py +++ b/examples/labs/need_data/viz.py @@ -3,7 +3,7 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: from __future__ import print_function # Python 2/3 compatibility __doc__ = """ -Example of activation image vizualization with nipy.labs vizualization tools +Example of activation image visualization with nipy.labs visualization tools Needs *example data* package. diff --git a/nipy/algorithms/clustering/ggmixture.py b/nipy/algorithms/clustering/ggmixture.py index a83120c53d..a5de354521 100644 --- a/nipy/algorithms/clustering/ggmixture.py +++ b/nipy/algorithms/clustering/ggmixture.py @@ -278,7 +278,7 @@ def estimate(self, x, niter=10, delta=0.0001, verbose=False): return L def show(self, x): - """ vizualisation of the mm based on the empirical histogram of x + """ Visualization of the mm based on the empirical histogram of x Parameters ---------- @@ -631,9 +631,7 @@ def component_likelihood(self, x): return ng, y, pg def show(self, x, mpaxes=None): - """ - Vizualization of the mixture, superimposed on the empirical - histogram of x + """ Visualization of mixture shown on the empirical histogram of x Parameters ---------- From 1143f823ea3d40eae4f1f0c1707e1870e496b0fb Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 12 Jan 2013 14:39:45 -0800 Subject: [PATCH 084/164] BF: make example compatible with Python3 Print statement; use of __doc__ --- examples/algorithms/mixed_effects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/algorithms/mixed_effects.py b/examples/algorithms/mixed_effects.py index ce1a94900e..c0d756820c 100644 --- a/examples/algorithms/mixed_effects.py +++ b/examples/algorithms/mixed_effects.py @@ -1,7 +1,8 @@ #!/usr/bin/env python # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -""" +from __future__ import print_function # Python 2/3 compatibility +__doc__ = """ This example illustrates the impact of using a mixed-effects model for the detection of the effects, when the first-level variance is known: If the first level variance is very variable across observations, then taking @@ -11,7 +12,7 @@ Author: Bertrand Thirion, 2012 """ -print __doc__ +print(__doc__) import numpy as np import matplotlib.pyplot as plt From 256137a9f101ff335157323c39e23c5c5781e19c Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 12 Jan 2013 16:53:37 -0800 Subject: [PATCH 085/164] DOC: remove copyright symbol from argparse It broke the 2to3 doctest fixers for Python 3.3 --- nipy/externals/argparse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/externals/argparse.py b/nipy/externals/argparse.py index fc9898aefc..20664eb71b 100644 --- a/nipy/externals/argparse.py +++ b/nipy/externals/argparse.py @@ -1,7 +1,7 @@ # emacs: -*- coding: utf-8; mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: -# Copyright © 2006-2009 Steven J. Bethard . +# Copyright 2006-2009 Steven J. Bethard . # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: From ce9732105baf0f280763f8afcab709e96a415baa Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 12 Jan 2013 17:40:01 -0800 Subject: [PATCH 086/164] BF: recythonize pyx files for Python 3.3 Python 3.3 complains about attempted relative imports for older Cython .c files; newer Cythons generate code that fixes this. --- nipy/algorithms/graph/_graph.c | 4028 +++++--- nipy/algorithms/registration/_registration.c | 3520 ++++--- nipy/algorithms/segmentation/_segmentation.c | 1543 ++-- nipy/algorithms/statistics/_quantile.c | 2122 +++-- nipy/algorithms/statistics/histogram.c | 1254 +-- nipy/algorithms/statistics/intvol.c | 7632 +++++++++------ nipy/labs/bindings/array.c | 4637 ++++++---- nipy/labs/bindings/linalg.c | 8683 ++++++++++++------ nipy/labs/bindings/wrapper.c | 4936 ++++++---- nipy/labs/glm/kalman.c | 4616 ++++++---- nipy/labs/group/glm_twolevel.c | 5202 ++++++----- nipy/labs/group/onesample.c | 5418 ++++++----- nipy/labs/group/routines.c | 3929 +++++--- nipy/labs/group/twosample.c | 4669 ++++++---- nipy/labs/utils/routines.c | 1420 +-- 15 files changed, 39002 insertions(+), 24607 deletions(-) diff --git a/nipy/algorithms/graph/_graph.c b/nipy/algorithms/graph/_graph.c index 942324fb52..ec927b4272 100644 --- a/nipy/algorithms/graph/_graph.c +++ b/nipy/algorithms/graph/_graph.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Mon May 9 18:32:23 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:26 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,131 +227,107 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE_API__nipy__labs__graph___graph -#include "stdlib.h" +#define __PYX_HAVE__nipy__algorithms__graph___graph +#define __PYX_HAVE_API__nipy__algorithms__graph___graph #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -281,8 +338,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -293,7 +348,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -301,54 +355,259 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "_graph.pyx", + "numpy.pxd", + "type.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -typedef __pyx_t_5numpy_float64_t __pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE; - -typedef __pyx_t_5numpy_int_t __pyx_t_4nipy_4labs_5graph_6_graph_INT; +/* "nipy/algorithms/graph/_graph.pyx":4 + * cimport numpy as np + * cimport cython + * ctypedef np.float64_t DOUBLE # <<<<<<<<<<<<<< + * ctypedef np.int_t INT + * + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE; +/* "nipy/algorithms/graph/_graph.pyx":5 + * cimport cython + * ctypedef np.float64_t DOUBLE + * ctypedef np.int_t INT # <<<<<<<<<<<<<< + * + * + */ +typedef __pyx_t_5numpy_int_t __pyx_t_4nipy_10algorithms_5graph_6_graph_INT; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -369,20 +628,47 @@ typedef __pyx_t_5numpy_int_t __pyx_t_4nipy_4labs_5graph_6_graph_INT; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -393,105 +679,110 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1}; -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long); @@ -507,7 +798,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -528,11 +818,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -543,7 +839,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -558,11 +857,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -573,11 +878,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -596,6 +902,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -608,57 +916,88 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ -/* Module declarations from stdio */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ -/* Module declarations from nipy.labs.graph._graph */ +/* Module declarations from 'cython' */ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE = { "nipy.labs.graph._graph.DOUBLE", NULL, sizeof(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_INT = { "nipy.labs.graph._graph.INT", NULL, sizeof(__pyx_t_4nipy_4labs_5graph_6_graph_INT), 'I' }; -#define __Pyx_MODULE_NAME "nipy.labs.graph._graph" -int __pyx_module_is_main_nipy__labs__graph___graph = 0; +/* Module declarations from 'nipy.algorithms.graph._graph' */ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE = { "DOUBLE", NULL, sizeof(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_INT = { "INT", NULL, sizeof(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT), { 0 }, 0, IS_UNSIGNED(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT), 0 }; +#define __Pyx_MODULE_NAME "nipy.algorithms.graph._graph" +int __pyx_module_is_main_nipy__algorithms__graph___graph = 0; -/* Implementation of nipy.labs.graph._graph */ +/* Implementation of 'nipy.algorithms.graph._graph' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; +static PyObject *__pyx_pf_4nipy_10algorithms_5graph_6_graph_dilation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_field, PyArrayObject *__pyx_v_idx, PyArrayObject *__pyx_v_neighb); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_3[] = "ndarray is not C contiguous"; +static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_7[] = "Non-native byte order not supported"; +static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_13[] = "Format string allocated too short."; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/algorithms/graph/_graph.pyx"; +static char __pyx_k_18[] = "nipy.algorithms.graph._graph"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -671,71 +1010,140 @@ static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; +static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; +static char __pyx_k__dim[] = "dim"; static char __pyx_k__idx[] = "idx"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__descr[] = "descr"; +static char __pyx_k__res[] = "res"; +static char __pyx_k__fmax[] = "fmax"; static char __pyx_k__field[] = "field"; -static char __pyx_k__names[] = "names"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; static char __pyx_k__neighb[] = "neighb"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__dilation[] = "dilation"; +static char __pyx_k__size_max[] = "size_max"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k__RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__d; +static PyObject *__pyx_n_s__dilation; +static PyObject *__pyx_n_s__dim; static PyObject *__pyx_n_s__field; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__fmax; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__idx; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__neighb; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__res; +static PyObject *__pyx_n_s__size_max; static PyObject *__pyx_int_0; static PyObject *__pyx_int_15; +static PyObject *__pyx_k_slice_1; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_codeobj_16; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_5graph_6_graph_1dilation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_5graph_6_graph_1dilation = {__Pyx_NAMESTR("dilation"), (PyCFunction)__pyx_pw_4nipy_10algorithms_5graph_6_graph_1dilation, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_5graph_6_graph_1dilation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_field = 0; + PyArrayObject *__pyx_v_idx = 0; + PyArrayObject *__pyx_v_neighb = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("dilation (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__idx,&__pyx_n_s__neighb,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__neighb)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "dilation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_field = ((PyArrayObject *)values[0]); + __pyx_v_idx = ((PyArrayObject *)values[1]); + __pyx_v_neighb = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.graph._graph.dilation", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_5numpy_ndarray, 1, "idx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_neighb), __pyx_ptype_5numpy_ndarray, 1, "neighb", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_5graph_6_graph_dilation(__pyx_self, __pyx_v_field, __pyx_v_idx, __pyx_v_neighb); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":12 +/* "nipy/algorithms/graph/_graph.pyx":12 * @cython.cdivision(True) * * def dilation(np.ndarray[DOUBLE, ndim=2] field,\ # <<<<<<<<<<<<<< @@ -743,33 +1151,24 @@ static PyObject *__pyx_int_15; * np.ndarray[INT, ndim=1] neighb): */ -static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_field = 0; - PyArrayObject *__pyx_v_idx = 0; - PyArrayObject *__pyx_v_neighb = 0; +static PyObject *__pyx_pf_4nipy_10algorithms_5graph_6_graph_dilation(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_field, PyArrayObject *__pyx_v_idx, PyArrayObject *__pyx_v_neighb) { int __pyx_v_size_max; int __pyx_v_dim; int __pyx_v_i; int __pyx_v_j; int __pyx_v_d; - __pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE __pyx_v_fmax; + __pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE __pyx_v_fmax; PyArrayObject *__pyx_v_res = 0; - Py_buffer __pyx_bstruct_idx; - Py_ssize_t __pyx_bstride_0_idx = 0; - Py_ssize_t __pyx_bshape_0_idx = 0; - Py_buffer __pyx_bstruct_res; - Py_ssize_t __pyx_bstride_0_res = 0; - Py_ssize_t __pyx_bshape_0_res = 0; - Py_buffer __pyx_bstruct_field; - Py_ssize_t __pyx_bstride_0_field = 0; - Py_ssize_t __pyx_bstride_1_field = 0; - Py_ssize_t __pyx_bshape_0_field = 0; - Py_ssize_t __pyx_bshape_1_field = 0; - Py_buffer __pyx_bstruct_neighb; - Py_ssize_t __pyx_bstride_0_neighb = 0; - Py_ssize_t __pyx_bshape_0_neighb = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_field; + __Pyx_Buffer __pyx_pybuffer_field; + __Pyx_LocalBuf_ND __pyx_pybuffernd_idx; + __Pyx_Buffer __pyx_pybuffer_idx; + __Pyx_LocalBuf_ND __pyx_pybuffernd_neighb; + __Pyx_Buffer __pyx_pybuffer_neighb; + __Pyx_LocalBuf_ND __pyx_pybuffernd_res; + __Pyx_Buffer __pyx_pybuffer_res; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyArrayObject *__pyx_t_3 = NULL; @@ -780,100 +1179,56 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se int __pyx_t_8; int __pyx_t_9; long __pyx_t_10; - __pyx_t_4nipy_4labs_5graph_6_graph_INT __pyx_t_11; + __pyx_t_4nipy_10algorithms_5graph_6_graph_INT __pyx_t_11; int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; - __pyx_t_4nipy_4labs_5graph_6_graph_INT __pyx_t_15; + __pyx_t_4nipy_10algorithms_5graph_6_graph_INT __pyx_t_15; int __pyx_t_16; int __pyx_t_17; int __pyx_t_18; - __pyx_t_4nipy_4labs_5graph_6_graph_INT __pyx_t_19; + __pyx_t_4nipy_10algorithms_5graph_6_graph_INT __pyx_t_19; int __pyx_t_20; int __pyx_t_21; int __pyx_t_22; int __pyx_t_23; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__field,&__pyx_n_s__idx,&__pyx_n_s__neighb,0}; - __Pyx_RefNannySetupContext("dilation"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__field); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__idx); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__neighb); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "dilation") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_field = ((PyArrayObject *)values[0]); - __pyx_v_idx = ((PyArrayObject *)values[1]); - __pyx_v_neighb = ((PyArrayObject *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_field = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_idx = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_neighb = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("dilation", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.graph._graph.dilation"); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_field); - __Pyx_INCREF((PyObject *)__pyx_v_idx); - __Pyx_INCREF((PyObject *)__pyx_v_neighb); - __pyx_bstruct_res.buf = NULL; - __pyx_bstruct_field.buf = NULL; - __pyx_bstruct_idx.buf = NULL; - __pyx_bstruct_neighb.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_field), __pyx_ptype_5numpy_ndarray, 1, "field", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_idx), __pyx_ptype_5numpy_ndarray, 1, "idx", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_neighb), __pyx_ptype_5numpy_ndarray, 1, "neighb", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("dilation", 0); + __pyx_pybuffer_res.pybuffer.buf = NULL; + __pyx_pybuffer_res.refcount = 0; + __pyx_pybuffernd_res.data = NULL; + __pyx_pybuffernd_res.rcbuffer = &__pyx_pybuffer_res; + __pyx_pybuffer_field.pybuffer.buf = NULL; + __pyx_pybuffer_field.refcount = 0; + __pyx_pybuffernd_field.data = NULL; + __pyx_pybuffernd_field.rcbuffer = &__pyx_pybuffer_field; + __pyx_pybuffer_idx.pybuffer.buf = NULL; + __pyx_pybuffer_idx.refcount = 0; + __pyx_pybuffernd_idx.data = NULL; + __pyx_pybuffernd_idx.rcbuffer = &__pyx_pybuffer_idx; + __pyx_pybuffer_neighb.pybuffer.buf = NULL; + __pyx_pybuffer_neighb.refcount = 0; + __pyx_pybuffernd_neighb.data = NULL; + __pyx_pybuffernd_neighb.rcbuffer = &__pyx_pybuffer_neighb; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_field, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_field.rcbuffer->pybuffer, (PyObject*)__pyx_v_field, &__Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_field = __pyx_bstruct_field.strides[0]; __pyx_bstride_1_field = __pyx_bstruct_field.strides[1]; - __pyx_bshape_0_field = __pyx_bstruct_field.shape[0]; __pyx_bshape_1_field = __pyx_bstruct_field.shape[1]; + __pyx_pybuffernd_field.diminfo[0].strides = __pyx_pybuffernd_field.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_field.diminfo[0].shape = __pyx_pybuffernd_field.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_field.diminfo[1].strides = __pyx_pybuffernd_field.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_field.diminfo[1].shape = __pyx_pybuffernd_field.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_idx, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_idx, &__Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_idx = __pyx_bstruct_idx.strides[0]; - __pyx_bshape_0_idx = __pyx_bstruct_idx.shape[0]; + __pyx_pybuffernd_idx.diminfo[0].strides = __pyx_pybuffernd_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_idx.diminfo[0].shape = __pyx_pybuffernd_idx.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_neighb, (PyObject*)__pyx_v_neighb, &__Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_neighb.rcbuffer->pybuffer, (PyObject*)__pyx_v_neighb, &__Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_INT, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_neighb = __pyx_bstruct_neighb.strides[0]; - __pyx_bshape_0_neighb = __pyx_bstruct_neighb.shape[0]; + __pyx_pybuffernd_neighb.diminfo[0].strides = __pyx_pybuffernd_neighb.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_neighb.diminfo[0].shape = __pyx_pybuffernd_neighb.rcbuffer->pybuffer.shape[0]; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":15 + /* "nipy/algorithms/graph/_graph.pyx":15 * np.ndarray[INT, ndim=1] idx,\ * np.ndarray[INT, ndim=1] neighb): * cdef int size_max = field.shape[0] # <<<<<<<<<<<<<< @@ -882,7 +1237,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se */ __pyx_v_size_max = (__pyx_v_field->dimensions[0]); - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":16 + /* "nipy/algorithms/graph/_graph.pyx":16 * np.ndarray[INT, ndim=1] neighb): * cdef int size_max = field.shape[0] * cdef int dim = field.shape[1] # <<<<<<<<<<<<<< @@ -891,26 +1246,15 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se */ __pyx_v_dim = (__pyx_v_field->dimensions[1]); - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":19 + /* "nipy/algorithms/graph/_graph.pyx":19 * cdef int i, j, d * cdef DOUBLE fmax * cdef np.ndarray[DOUBLE, ndim=1] res = 0 * field[:, 0] # <<<<<<<<<<<<<< * for d in range(dim): * for i in range(size_max): */ - __pyx_t_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_field), ((PyObject *)__pyx_k_tuple_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_0); - __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_field), __pyx_t_2); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyNumber_Multiply(__pyx_int_0, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -918,18 +1262,17 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se __pyx_t_3 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_res, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_res.buf = NULL; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_res.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_res.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } else {__pyx_bstride_0_res = __pyx_bstruct_res.strides[0]; - __pyx_bshape_0_res = __pyx_bstruct_res.shape[0]; + } else {__pyx_pybuffernd_res.diminfo[0].strides = __pyx_pybuffernd_res.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_res.diminfo[0].shape = __pyx_pybuffernd_res.rcbuffer->pybuffer.shape[0]; } } __pyx_t_3 = 0; __pyx_v_res = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":20 + /* "nipy/algorithms/graph/_graph.pyx":20 * cdef DOUBLE fmax * cdef np.ndarray[DOUBLE, ndim=1] res = 0 * field[:, 0] * for d in range(dim): # <<<<<<<<<<<<<< @@ -940,7 +1283,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_d = __pyx_t_5; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":21 + /* "nipy/algorithms/graph/_graph.pyx":21 * cdef np.ndarray[DOUBLE, ndim=1] res = 0 * field[:, 0] * for d in range(dim): * for i in range(size_max): # <<<<<<<<<<<<<< @@ -951,7 +1294,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":22 + /* "nipy/algorithms/graph/_graph.pyx":22 * for d in range(dim): * for i in range(size_max): * fmax = field[i, d] # <<<<<<<<<<<<<< @@ -960,9 +1303,9 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se */ __pyx_t_8 = __pyx_v_i; __pyx_t_9 = __pyx_v_d; - __pyx_v_fmax = (*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_field.buf, __pyx_t_8, __pyx_bstride_0_field, __pyx_t_9, __pyx_bstride_1_field)); + __pyx_v_fmax = (*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_field.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_field.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_field.diminfo[1].strides)); - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":23 + /* "nipy/algorithms/graph/_graph.pyx":23 * for i in range(size_max): * fmax = field[i, d] * for j in range(idx[i], idx[i + 1]): # <<<<<<<<<<<<<< @@ -970,12 +1313,12 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se * fmax = field[neighb[j], d] */ __pyx_t_10 = (__pyx_v_i + 1); - __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_INT *, __pyx_bstruct_idx.buf, __pyx_t_10, __pyx_bstride_0_idx)); + __pyx_t_11 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_idx.diminfo[0].strides)); __pyx_t_12 = __pyx_v_i; - for (__pyx_t_13 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_INT *, __pyx_bstruct_idx.buf, __pyx_t_12, __pyx_bstride_0_idx)); __pyx_t_13 < __pyx_t_11; __pyx_t_13+=1) { + for (__pyx_t_13 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT *, __pyx_pybuffernd_idx.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_idx.diminfo[0].strides)); __pyx_t_13 < __pyx_t_11; __pyx_t_13+=1) { __pyx_v_j = __pyx_t_13; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":24 + /* "nipy/algorithms/graph/_graph.pyx":24 * fmax = field[i, d] * for j in range(idx[i], idx[i + 1]): * if field[neighb[j], d] > fmax: # <<<<<<<<<<<<<< @@ -983,12 +1326,12 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se * res[i] = fmax */ __pyx_t_14 = __pyx_v_j; - __pyx_t_15 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_INT *, __pyx_bstruct_neighb.buf, __pyx_t_14, __pyx_bstride_0_neighb)); + __pyx_t_15 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT *, __pyx_pybuffernd_neighb.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_neighb.diminfo[0].strides)); __pyx_t_16 = __pyx_v_d; - __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_field.buf, __pyx_t_15, __pyx_bstride_0_field, __pyx_t_16, __pyx_bstride_1_field)) > __pyx_v_fmax); + __pyx_t_17 = ((*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_field.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_field.diminfo[0].strides, __pyx_t_16, __pyx_pybuffernd_field.diminfo[1].strides)) > __pyx_v_fmax); if (__pyx_t_17) { - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":25 + /* "nipy/algorithms/graph/_graph.pyx":25 * for j in range(idx[i], idx[i + 1]): * if field[neighb[j], d] > fmax: * fmax = field[neighb[j], d] # <<<<<<<<<<<<<< @@ -996,15 +1339,15 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se * for i in range(size_max): */ __pyx_t_18 = __pyx_v_j; - __pyx_t_19 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_INT *, __pyx_bstruct_neighb.buf, __pyx_t_18, __pyx_bstride_0_neighb)); + __pyx_t_19 = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_INT *, __pyx_pybuffernd_neighb.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_neighb.diminfo[0].strides)); __pyx_t_20 = __pyx_v_d; - __pyx_v_fmax = (*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_field.buf, __pyx_t_19, __pyx_bstride_0_field, __pyx_t_20, __pyx_bstride_1_field)); - goto __pyx_L12; + __pyx_v_fmax = (*__Pyx_BufPtrStrided2d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_field.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_field.diminfo[0].strides, __pyx_t_20, __pyx_pybuffernd_field.diminfo[1].strides)); + goto __pyx_L9; } - __pyx_L12:; + __pyx_L9:; } - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":26 + /* "nipy/algorithms/graph/_graph.pyx":26 * if field[neighb[j], d] > fmax: * fmax = field[neighb[j], d] * res[i] = fmax # <<<<<<<<<<<<<< @@ -1012,10 +1355,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se * field[i, d] = res[i] */ __pyx_t_13 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_res.buf, __pyx_t_13, __pyx_bstride_0_res) = __pyx_v_fmax; + *__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_res.diminfo[0].strides) = __pyx_v_fmax; } - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":27 + /* "nipy/algorithms/graph/_graph.pyx":27 * fmax = field[neighb[j], d] * res[i] = fmax * for i in range(size_max): # <<<<<<<<<<<<<< @@ -1026,7 +1369,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":28 + /* "nipy/algorithms/graph/_graph.pyx":28 * res[i] = fmax * for i in range(size_max): * field[i, d] = res[i] # <<<<<<<<<<<<<< @@ -1035,11 +1378,11 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se __pyx_t_21 = __pyx_v_i; __pyx_t_22 = __pyx_v_i; __pyx_t_23 = __pyx_v_d; - *__Pyx_BufPtrStrided2d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_field.buf, __pyx_t_22, __pyx_bstride_0_field, __pyx_t_23, __pyx_bstride_1_field) = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_4labs_5graph_6_graph_DOUBLE *, __pyx_bstruct_res.buf, __pyx_t_21, __pyx_bstride_0_res)); + *__Pyx_BufPtrStrided2d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_field.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_field.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_field.diminfo[1].strides) = (*__Pyx_BufPtrStrided1d(__pyx_t_4nipy_10algorithms_5graph_6_graph_DOUBLE *, __pyx_pybuffernd_res.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_res.diminfo[0].strides)); } } - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":29 + /* "nipy/algorithms/graph/_graph.pyx":29 * for i in range(size_max): * field[i, d] = res[i] * return res # <<<<<<<<<<<<<< @@ -1056,30 +1399,38 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se __Pyx_XDECREF(__pyx_t_2); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_idx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_res); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_field.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighb.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("nipy.labs.graph._graph.dilation"); + __Pyx_AddTraceback("nipy.algorithms.graph._graph.dilation", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_idx); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_res); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_field); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_neighb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_field.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_idx.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_neighb.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_res.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_res); - __Pyx_DECREF((PyObject *)__pyx_v_field); - __Pyx_DECREF((PyObject *)__pyx_v_idx); - __Pyx_DECREF((PyObject *)__pyx_v_neighb); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1087,8 +1438,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5graph_6_graph_dilation(PyObject *__pyx_se * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -1100,23 +1450,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -1124,7 +1493,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1133,16 +1502,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1152,7 +1521,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1160,11 +1529,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1173,9 +1542,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1185,43 +1554,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1231,142 +1594,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1375,25 +1731,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1402,17 +1758,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1421,7 +1779,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1437,7 +1795,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1449,49 +1807,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1502,50 +1861,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -1554,10 +1907,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1567,10 +1920,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1580,10 +1933,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1593,10 +1946,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1606,10 +1959,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1619,10 +1972,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1632,10 +1985,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1645,10 +1998,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1658,10 +2011,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1671,10 +2024,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1684,10 +2037,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1697,10 +2050,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1710,10 +2063,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1723,10 +2076,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1736,10 +2089,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -1749,10 +2102,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -1762,37 +2115,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -1801,7 +2154,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -1810,105 +2163,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -1916,11 +2278,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1930,7 +2292,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -1938,15 +2300,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -1956,10 +2317,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -1967,7 +2332,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1977,7 +2342,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1985,7 +2350,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -1995,10 +2360,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2006,7 +2375,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2016,7 +2385,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2024,7 +2393,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2034,10 +2403,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2045,7 +2418,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2055,7 +2428,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2063,7 +2436,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2073,10 +2446,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2084,7 +2461,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2094,7 +2471,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2102,7 +2479,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2112,10 +2489,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2123,7 +2504,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2133,7 +2514,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2141,7 +2522,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2150,33 +2531,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2185,7 +2566,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2194,167 +2575,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2362,16 +2770,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2380,469 +2787,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -2855,24 +3241,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -2882,12 +3267,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -2897,7 +3281,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -2909,7 +3293,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -2918,7 +3302,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -2929,7 +3313,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -2938,7 +3322,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -2947,12 +3331,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -2962,11 +3344,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -2976,7 +3358,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -2991,7 +3373,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3005,19 +3387,15 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("dilation"), (PyCFunction)__pyx_pf_4nipy_4labs_5graph_6_graph_dilation, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, @@ -3033,45 +3411,196 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, + {&__pyx_n_s__dilation, __pyx_k__dilation, sizeof(__pyx_k__dilation), 0, 0, 1, 1}, + {&__pyx_n_s__dim, __pyx_k__dim, sizeof(__pyx_k__dim), 0, 0, 1, 1}, {&__pyx_n_s__field, __pyx_k__field, sizeof(__pyx_k__field), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__fmax, __pyx_k__fmax, sizeof(__pyx_k__fmax), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__neighb, __pyx_k__neighb, sizeof(__pyx_k__neighb), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, + {&__pyx_n_s__size_max, __pyx_k__size_max, sizeof(__pyx_k__size_max), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "nipy/algorithms/graph/_graph.pyx":19 + * cdef int i, j, d + * cdef DOUBLE fmax + * cdef np.ndarray[DOUBLE, ndim=1] res = 0 * field[:, 0] # <<<<<<<<<<<<<< + * for d in range(dim): + * for i in range(size_max): + */ + __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_1); + __Pyx_GIVEREF(__pyx_k_slice_1); + __pyx_k_tuple_2 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(__pyx_k_slice_1); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, __pyx_k_slice_1); + __Pyx_GIVEREF(__pyx_k_slice_1); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "nipy/algorithms/graph/_graph.pyx":12 + * @cython.cdivision(True) + * + * def dilation(np.ndarray[DOUBLE, ndim=2] field,\ # <<<<<<<<<<<<<< + * np.ndarray[INT, ndim=1] idx,\ + * np.ndarray[INT, ndim=1] neighb): + */ + __pyx_k_tuple_15 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__field)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__field)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__field)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__neighb)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__neighb)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__neighb)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__size_max)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__size_max)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size_max)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dim)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__dim)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 6, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 7, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fmax)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 8, ((PyObject *)__pyx_n_s__fmax)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fmax)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__res)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 9, ((PyObject *)__pyx_n_s__res)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(3, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__dilation, 12, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -3093,8 +3622,8 @@ PyMODINIT_FUNC PyInit__graph(void) #endif { PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -3102,14 +3631,19 @@ PyMODINIT_FUNC PyInit__graph(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit__graph(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__graph(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3120,72 +3654,101 @@ PyMODINIT_FUNC PyInit__graph(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_graph"), __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_graph"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.graph._graph")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.graph._graph", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_module_is_main_nipy__labs__graph___graph) { + if (__pyx_module_is_main_nipy__algorithms__graph___graph) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":1 + /* "nipy/algorithms/graph/_graph.pyx":1 * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * cimport cython */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/data/thirion/mygit/nipy/nipy/labs/graph/_graph.pyx":12 + /* "nipy/algorithms/graph/_graph.pyx":12 * @cython.cdivision(True) * * def dilation(np.ndarray[DOUBLE, ndim=2] field,\ # <<<<<<<<<<<<<< * np.ndarray[INT, ndim=1] idx,\ * np.ndarray[INT, ndim=1] neighb): + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_5graph_6_graph_1dilation, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dilation, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/algorithms/graph/_graph.pyx":1 + * import numpy as np # <<<<<<<<<<<<<< + * cimport numpy as np + * cimport cython */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython/Includes/stdlib.pxd":2 + /* "numpy.pxd":975 + * arr.base = baseptr * - * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< - * void free(void *ptr) - * void *malloc(size_t size) + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.graph._graph"); + __Pyx_AddTraceback("init nipy.algorithms.graph._graph", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init nipy.labs.graph._graph"); + PyErr_SetString(PyExc_ImportError, "init nipy.algorithms.graph._graph"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3196,28 +3759,36 @@ PyMODINIT_FUNC PyInit__graph(void) #endif } -static const char *__pyx_filenames[] = { - "_graph.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseArgtupleInvalid( @@ -3228,8 +3799,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -3240,14 +3810,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -3262,55 +3841,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; } - if (*name) { + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; - } + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -3329,21 +3930,30 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - int new_count, enc_count; - int is_complex; - char enc_type; - char packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -3356,11 +3966,14 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; - ctx->packmode = '@'; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -3368,7 +3981,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -3384,15 +3996,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - char msg[] = {ch, 0}; - PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -3408,14 +4026,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -3431,10 +4049,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -3448,10 +4065,9 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; - } + } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -3460,17 +4076,16 @@ typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); @@ -3481,21 +4096,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - -static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; - } + } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -3520,56 +4173,77 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - - if (ctx->packmode == '@' || ctx->packmode == '^') { + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } - if (ctx->packmode == '@') { - int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - int align_mod_offset; + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " - "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -3599,17 +4273,50 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; - return 0; -} - -static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { - if (ctx->enc_type != 0 || ctx->packmode != '@') { - PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); - return -1; - } return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -3624,7 +4331,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -3635,8 +4342,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; + ctx->new_packmode = '='; ++ts; break; case '>': @@ -3645,27 +4351,29 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; + ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = *ts++; + ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { - int i; const char* ts_after_sub; - int struct_count = ctx->new_count; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -3673,10 +4381,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -3684,6 +4401,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': @@ -3696,14 +4414,14 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { - /* Continue pooling same type */ + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } @@ -3711,21 +4429,23 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha ctx->new_count = 1; got_Z = 0; break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); - if (ctx->new_count == -1) { /* First char was not a digit */ - char msg[2] = { *ts, 0 }; - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%s')", msg); - return NULL; - } + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } - } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -3733,9 +4453,11 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } @@ -3754,10 +4476,9 @@ static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeI } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, (dtype->size > 1) ? "s" : ""); + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; @@ -3766,7 +4487,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -3786,9 +4506,9 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -3798,124 +4518,316 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); } } - return item; +bad: + Py_XDECREF(owned_instance); + return; } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } } + return 0; +#endif } -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) - return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { -if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -3931,38 +4843,73 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long val) { - const npy_long neg_one = (npy_long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_long) < sizeof(long)) { + const npy_long neg_one = (npy_long)-1, const_zero = (npy_long)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_long) == sizeof(char)) || + (sizeof(npy_long) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_long) == sizeof(long)) { + } else if ((sizeof(npy_long) == sizeof(int)) || + (sizeof(npy_long) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_long) > sizeof(long)) */ + } else if (sizeof(npy_long) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_long), + little, !is_unsigned); } } @@ -4030,15 +4977,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4105,125 +5097,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_long(npy_long val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -4397,6 +5324,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -4418,9 +5364,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -4453,9 +5399,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -4488,9 +5434,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -4523,9 +5469,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -4558,9 +5504,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -4593,9 +5539,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -4607,24 +5553,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -4635,19 +5612,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -4656,54 +5637,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -4714,28 +5750,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -4743,11 +5796,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -4782,11 +5833,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/algorithms/registration/_registration.c b/nipy/algorithms/registration/_registration.c index 606df12c86..ad9ed611f1 100644 --- a/nipy/algorithms/registration/_registration.c +++ b/nipy/algorithms/registration/_registration.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Mon Oct 8 08:46:36 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:27 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -269,7 +288,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -293,8 +312,12 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -319,7 +342,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -329,7 +351,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -337,18 +358,19 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "_registration.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -357,7 +379,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -366,7 +388,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -375,7 +397,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -384,7 +406,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -393,7 +415,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -402,7 +424,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -411,7 +433,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -420,7 +442,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -429,7 +451,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -438,7 +460,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -447,7 +469,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -456,7 +478,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -465,7 +487,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -474,7 +496,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -483,7 +505,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -492,7 +514,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -501,7 +523,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -510,7 +532,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -519,7 +541,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -528,7 +550,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -536,7 +558,6 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -557,9 +578,10 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -568,7 +590,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -577,7 +599,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -586,7 +608,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -594,11 +616,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -611,8 +631,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -623,7 +656,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -634,16 +667,19 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ @@ -653,32 +689,38 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); -#include - -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ - -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) @@ -691,7 +733,6 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -812,15 +853,38 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -829,6 +893,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -839,14 +908,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'nipy.algorithms.registration._registration' */ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(PyObject *, PyArrayObject *); /*proto*/ @@ -857,6 +919,18 @@ int __pyx_module_is_main_nipy__algorithms__registration___registration = 0; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_H, PyArrayIterObject *__pyx_v_iterI, PyArrayObject *__pyx_v_imJ, PyArrayObject *__pyx_v_Tvox, long __pyx_v_interp); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_L1_moments(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_H); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_transform(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_mode); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8_cspline_sample2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_mx, PyObject *__pyx_v_my); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_10_cspline_sample3d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_Z, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_12_cspline_sample4d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_Z, PyObject *__pyx_v_T, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz, PyObject *__pyx_v_mt); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_14_cspline_resample3d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_im, PyObject *__pyx_v_dims, PyArrayObject *__pyx_v_Tvox, PyObject *__pyx_v_dtype, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_16check_array(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, int __pyx_v_dim, int __pyx_v_exp_dim, PyObject *__pyx_v_xname); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_18_apply_polyaffine(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_centers, PyArrayObject *__pyx_v_affines, PyArrayObject *__pyx_v_sigma); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "Joint histogram failed because of incorrect input arrays."; static char __pyx_k_3[] = "L1_moments failed because input array is not double."; static char __pyx_k_5[] = "%s array should be double C-contiguous"; @@ -870,7 +944,8 @@ static char __pyx_k_16[] = "Format string allocated too short, see comment in nu static char __pyx_k_19[] = "Format string allocated too short."; static char __pyx_k_21[] = "\nBindings for various image registration routines written in C: joint\nhistogram computation, cubic spline interpolation, non-rigid\ntransformations. \n"; static char __pyx_k_22[] = "0.3"; -static char __pyx_k_23[] = "nipy.algorithms.registration._registration"; +static char __pyx_k_25[] = "/Users/mb312/dev_trees/nipy/nipy/algorithms/registration/_registration.pyx"; +static char __pyx_k_26[] = "nipy.algorithms.registration._registration"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -884,15 +959,25 @@ static char __pyx_k__X[] = "X"; static char __pyx_k__Y[] = "Y"; static char __pyx_k__Z[] = "Z"; static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; +static char __pyx_k__n[] = "n"; static char __pyx_k__q[] = "q"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__t[] = "t"; static char __pyx_k__u[] = "u"; static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; +static char __pyx_k__Ta[] = "Ta"; +static char __pyx_k__Xa[] = "Xa"; +static char __pyx_k__Ya[] = "Ya"; +static char __pyx_k__Za[] = "Za"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; @@ -902,20 +987,24 @@ static char __pyx_k__mx[] = "mx"; static char __pyx_k__my[] = "my"; static char __pyx_k__mz[] = "mz"; static char __pyx_k__np[] = "np"; +static char __pyx_k__dev[] = "dev"; static char __pyx_k__dim[] = "dim"; static char __pyx_k__imJ[] = "imJ"; +static char __pyx_k__ret[] = "ret"; static char __pyx_k__xyz[] = "xyz"; static char __pyx_k__Tvox[] = "Tvox"; static char __pyx_k__dims[] = "dims"; static char __pyx_k__kind[] = "kind"; static char __pyx_k__mode[] = "mode"; static char __pyx_k__size[] = "size"; +static char __pyx_k__tvox[] = "tvox"; static char __pyx_k__zero[] = "zero"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__flags[] = "flags"; static char __pyx_k__index[] = "index"; static char __pyx_k__iterI[] = "iterI"; static char __pyx_k__modes[] = "modes"; +static char __pyx_k__multi[] = "multi"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__order[] = "order"; static char __pyx_k__range[] = "range"; @@ -923,8 +1012,11 @@ static char __pyx_k__sigma[] = "sigma"; static char __pyx_k__xname[] = "xname"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__astype[] = "astype"; +static char __pyx_k__clampI[] = "clampI"; +static char __pyx_k__clampJ[] = "clampJ"; static char __pyx_k__double[] = "double"; static char __pyx_k__interp[] = "interp"; +static char __pyx_k__median[] = "median"; static char __pyx_k__affines[] = "affines"; static char __pyx_k__asarray[] = "asarray"; static char __pyx_k__centers[] = "centers"; @@ -940,6 +1032,8 @@ static char __pyx_k____version__[] = "__version__"; static char __pyx_k__check_array[] = "check_array"; static char __pyx_k__C_CONTIGUOUS[] = "C_CONTIGUOUS"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__cast_integer[] = "cast_integer"; +static char __pyx_k__im_resampled[] = "im_resampled"; static char __pyx_k___joint_histogram[] = "_joint_histogram"; static char __pyx_k___apply_polyaffine[] = "_apply_polyaffine"; static char __pyx_k___cspline_sample1d[] = "_cspline_sample1d"; @@ -955,7 +1049,8 @@ static PyObject *__pyx_kp_u_15; static PyObject *__pyx_kp_u_16; static PyObject *__pyx_kp_u_19; static PyObject *__pyx_kp_s_22; -static PyObject *__pyx_n_s_23; +static PyObject *__pyx_kp_s_25; +static PyObject *__pyx_n_s_26; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_5; static PyObject *__pyx_kp_s_6; @@ -967,11 +1062,15 @@ static PyObject *__pyx_n_s__H; static PyObject *__pyx_n_s__R; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__T; +static PyObject *__pyx_n_s__Ta; static PyObject *__pyx_n_s__Tvox; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s__Xa; static PyObject *__pyx_n_s__Y; +static PyObject *__pyx_n_s__Ya; static PyObject *__pyx_n_s__Z; +static PyObject *__pyx_n_s__Za; static PyObject *__pyx_n_s___L1_moments; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; @@ -987,40 +1086,56 @@ static PyObject *__pyx_n_s___joint_histogram; static PyObject *__pyx_n_s__affines; static PyObject *__pyx_n_s__asarray; static PyObject *__pyx_n_s__astype; +static PyObject *__pyx_n_s__c; +static PyObject *__pyx_n_s__cast_integer; static PyObject *__pyx_n_s__centers; static PyObject *__pyx_n_s__check_array; +static PyObject *__pyx_n_s__clampI; +static PyObject *__pyx_n_s__clampJ; +static PyObject *__pyx_n_s__dev; static PyObject *__pyx_n_s__dim; static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__exp_dim; static PyObject *__pyx_n_s__flags; +static PyObject *__pyx_n_s__h; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__im; static PyObject *__pyx_n_s__imJ; +static PyObject *__pyx_n_s__im_resampled; static PyObject *__pyx_n_s__index; static PyObject *__pyx_n_s__interp; static PyObject *__pyx_n_s__iterI; static PyObject *__pyx_n_s__kind; +static PyObject *__pyx_n_s__median; static PyObject *__pyx_n_s__mode; static PyObject *__pyx_n_s__modes; static PyObject *__pyx_n_s__mt; +static PyObject *__pyx_n_s__multi; static PyObject *__pyx_n_s__mx; static PyObject *__pyx_n_s__my; static PyObject *__pyx_n_s__mz; +static PyObject *__pyx_n_s__n; static PyObject *__pyx_n_s__nearest; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__r; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__reflect; static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__ret; static PyObject *__pyx_n_s__sigma; static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__tvox; static PyObject *__pyx_n_s__u; static PyObject *__pyx_n_s__x; static PyObject *__pyx_n_s__xname; static PyObject *__pyx_n_s__xyz; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__z; static PyObject *__pyx_n_s__zero; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_0; @@ -1038,42 +1153,47 @@ static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_17; static PyObject *__pyx_k_tuple_18; static PyObject *__pyx_k_tuple_20; - -/* "nipy/algorithms/registration/_registration.pyx":57 - * - * - * def _joint_histogram(ndarray H, flatiter iterI, ndarray imJ, ndarray Tvox, long interp): # <<<<<<<<<<<<<< - * """ - * Compute the joint histogram given a transformation trial. - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_41; +static PyObject *__pyx_k_tuple_43; +static PyObject *__pyx_k_codeobj_24; +static PyObject *__pyx_k_codeobj_28; +static PyObject *__pyx_k_codeobj_30; +static PyObject *__pyx_k_codeobj_32; +static PyObject *__pyx_k_codeobj_34; +static PyObject *__pyx_k_codeobj_36; +static PyObject *__pyx_k_codeobj_38; +static PyObject *__pyx_k_codeobj_40; +static PyObject *__pyx_k_codeobj_42; +static PyObject *__pyx_k_codeobj_44; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_1_joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram[] = "\n Compute the joint histogram given a transformation trial. \n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration__joint_histogram = {__Pyx_NAMESTR("_joint_histogram"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_joint_histogram = {__Pyx_NAMESTR("_joint_histogram"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_1_joint_histogram, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration__joint_histogram)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_1_joint_histogram(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_H = 0; PyArrayIterObject *__pyx_v_iterI = 0; PyArrayObject *__pyx_v_imJ = 0; PyArrayObject *__pyx_v_Tvox = 0; long __pyx_v_interp; - unsigned int __pyx_v_clampI; - unsigned int __pyx_v_clampJ; - int __pyx_v_ret; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__H,&__pyx_n_s__iterI,&__pyx_n_s__imJ,&__pyx_n_s__Tvox,&__pyx_n_s__interp,0}; - __Pyx_RefNannySetupContext("_joint_histogram"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_joint_histogram (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__H,&__pyx_n_s__iterI,&__pyx_n_s__imJ,&__pyx_n_s__Tvox,&__pyx_n_s__interp,0}; PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1083,38 +1203,33 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__H); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__H)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterI); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__iterI)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imJ); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__imJ)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_joint_histogram", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_joint_histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_joint_histogram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -1143,6 +1258,35 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iterI), __pyx_ptype_5numpy_flatiter, 1, "iterI", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_imJ), __pyx_ptype_5numpy_ndarray, 1, "imJ", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Tvox), __pyx_ptype_5numpy_ndarray, 1, "Tvox", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(__pyx_self, __pyx_v_H, __pyx_v_iterI, __pyx_v_imJ, __pyx_v_Tvox, __pyx_v_interp); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":57 + * + * + * def _joint_histogram(ndarray H, flatiter iterI, ndarray imJ, ndarray Tvox, long interp): # <<<<<<<<<<<<<< + * """ + * Compute the joint histogram given a transformation trial. + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joint_histogram(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_H, PyArrayIterObject *__pyx_v_iterI, PyArrayObject *__pyx_v_imJ, PyArrayObject *__pyx_v_Tvox, long __pyx_v_interp) { + unsigned int __pyx_v_clampI; + unsigned int __pyx_v_clampJ; + int __pyx_v_ret; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_joint_histogram", 0); /* "nipy/algorithms/registration/_registration.pyx":67 * @@ -1193,9 +1337,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "nipy/algorithms/registration/_registration.pyx":75 * raise RuntimeError('Joint histogram failed because of incorrect input arrays.') @@ -1220,6 +1364,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_3_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_2_L1_moments[] = "\n Compute L1 moments of order 0, 1 and 2 of a one-dimensional\n histogram.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_L1_moments = {__Pyx_NAMESTR("_L1_moments"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_3_L1_moments, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_2_L1_moments)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_3_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_L1_moments (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_5numpy_ndarray, 1, "H", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_2_L1_moments(__pyx_self, ((PyArrayObject *)__pyx_v_H)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/registration/_registration.pyx":78 * * @@ -1228,10 +1390,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration__joi * Compute L1 moments of order 0, 1 and 2 of a one-dimensional */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_1_L1_moments[] = "\n Compute L1 moments of order 0, 1 and 2 of a one-dimensional\n histogram.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_L1_moments = {__Pyx_NAMESTR("_L1_moments"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_1_L1_moments)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1_moments(PyObject *__pyx_self, PyObject *__pyx_v_H) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_L1_moments(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_H) { double __pyx_v_n[1]; double __pyx_v_median[1]; double __pyx_v_dev[1]; @@ -1246,9 +1405,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_L1_moments"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_H), __pyx_ptype_5numpy_ndarray, 1, "H", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("_L1_moments", 0); /* "nipy/algorithms/registration/_registration.pyx":87 * int ret @@ -1257,7 +1414,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 * if not ret == 0: * raise RuntimeError('L1_moments failed because input array is not double.') */ - __pyx_v_ret = L1_moments(__pyx_v_n, __pyx_v_median, __pyx_v_dev, ((PyArrayObject *)__pyx_v_H)); + __pyx_v_ret = L1_moments(__pyx_v_n, __pyx_v_median, __pyx_v_dev, __pyx_v_H); /* "nipy/algorithms/registration/_registration.pyx":88 * @@ -1281,9 +1438,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; /* "nipy/algorithms/registration/_registration.pyx":91 * raise RuntimeError('L1_moments failed because input array is not double.') @@ -1300,7 +1457,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 __pyx_t_4 = PyFloat_FromDouble((__pyx_v_dev[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); @@ -1329,6 +1486,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_5_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_transform = {__Pyx_NAMESTR("_cspline_transform"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_5_cspline_transform, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_5_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_cspline_transform (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_transform(__pyx_self, ((PyArrayObject *)__pyx_v_x)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/registration/_registration.pyx":94 * * @@ -1337,9 +1511,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_1_L1 * cubic_spline_transform(c, x) */ -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_2_cspline_transform = {__Pyx_NAMESTR("_cspline_transform"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform, METH_O, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cspline_transform(PyObject *__pyx_self, PyObject *__pyx_v_x) { +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_transform(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x) { PyObject *__pyx_v_c = NULL; int __pyx_v_i; PyObject *__pyx_r = NULL; @@ -1354,9 +1526,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cs int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_cspline_transform"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("_cspline_transform", 0); /* "nipy/algorithms/registration/_registration.pyx":95 * @@ -1371,17 +1541,17 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cs __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = ((PyArrayObject *)__pyx_v_x)->nd; + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_v_x->nd; for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((((PyArrayObject *)__pyx_v_x)->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_x->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -1395,7 +1565,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cs __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -1413,7 +1583,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_2_cs if (!(likely(((__pyx_v_c) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_c, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = __pyx_v_c; __Pyx_INCREF(__pyx_t_7); - cubic_spline_transform(((PyArrayObject *)__pyx_t_7), ((PyArrayObject *)__pyx_v_x)); + cubic_spline_transform(((PyArrayObject *)__pyx_t_7), __pyx_v_x); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; /* "nipy/algorithms/registration/_registration.pyx":97 @@ -1466,7 +1636,7 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_reshaped_double"); + __Pyx_RefNannySetupContext("_reshaped_double", 0); /* "nipy/algorithms/registration/_registration.pyx":100 * @@ -1476,18 +1646,20 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration_ * */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __pyx_v_sh_arr->nd; for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_sh_arr->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __pyx_v_shape = __pyx_t_1; + __pyx_t_4 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_shape = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; /* "nipy/algorithms/registration/_registration.pyx":101 * cdef ndarray _reshaped_double(object in_arr, ndarray sh_arr): @@ -1497,43 +1669,43 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration_ * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_in_arr); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_in_arr); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_in_arr); __Pyx_GIVEREF(__pyx_v_in_arr); __Pyx_INCREF(((PyObject *)__pyx_v_shape)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_shape)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_shape)); __Pyx_GIVEREF(((PyObject *)__pyx_v_shape)); - __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__astype); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_4); - __pyx_t_4 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -1551,45 +1723,26 @@ static PyArrayObject *__pyx_f_4nipy_10algorithms_12registration_13_registration_ return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":103 - * return np.reshape(in_arr, shape).astype(np.double) - * - * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): # <<<<<<<<<<<<<< - * cdef double *r, *x - * cdef broadcast multi - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d = {__Pyx_NAMESTR("_cspline_sample1d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_7_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_sample1d = {__Pyx_NAMESTR("_cspline_sample1d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_7_cspline_sample1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_7_cspline_sample1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_mode = 0; - double *__pyx_v_r; - double *__pyx_v_x; - PyArrayMultiIterObject *__pyx_v_multi = 0; - PyArrayObject *__pyx_v_Xa = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__mode,0}; - __Pyx_RefNannySetupContext("_cspline_sample1d"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_cspline_sample1d (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__mode,0}; PyObject* values[4] = {0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_n_s__zero); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -1598,14 +1751,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cs default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_sample1d", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1621,7 +1772,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cs } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cspline_sample1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1648,12 +1799,45 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cs __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "nipy/algorithms/registration/_registration.pyx":106 - * cdef double *r, *x - * cdef broadcast multi - * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< - * multi = PyArray_MultiIterNew(2, R, Xa) + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample1d(__pyx_self, __pyx_v_R, __pyx_v_C, __pyx_v_X, __pyx_v_mode); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":103 + * return np.reshape(in_arr, shape).astype(np.double) + * + * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): # <<<<<<<<<<<<<< + * cdef double *r, *x + * cdef broadcast multi + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_mode) { + double *__pyx_v_r; + double *__pyx_v_x; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_cspline_sample1d", 0); + + /* "nipy/algorithms/registration/_registration.pyx":106 + * cdef double *r, *x + * cdef broadcast multi + * Xa = _reshaped_double(X, R) # <<<<<<<<<<<<<< + * multi = PyArray_MultiIterNew(2, R, Xa) * while(multi.index < multi.size): */ __pyx_t_1 = ((PyObject *)__pyx_f_4nipy_10algorithms_12registration_13_registration__reshaped_double(__pyx_v_X, __pyx_v_R)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1686,8 +1870,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cs __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_multi), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1766,44 +1949,21 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_3_cs return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":115 - * return R - * - * def _cspline_sample2d(ndarray R, ndarray C, X=0, Y=0, # <<<<<<<<<<<<<< - * mx='zero', my='zero'): - * cdef double *r, *x, *y - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d = {__Pyx_NAMESTR("_cspline_sample2d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_9_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_cspline_sample2d = {__Pyx_NAMESTR("_cspline_sample2d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_9_cspline_sample2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_9_cspline_sample2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; PyObject *__pyx_v_mx = 0; PyObject *__pyx_v_my = 0; - double *__pyx_v_r; - double *__pyx_v_x; - double *__pyx_v_y; - PyArrayMultiIterObject *__pyx_v_multi = 0; - PyArrayObject *__pyx_v_Xa = NULL; - PyArrayObject *__pyx_v_Ya = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__mx,&__pyx_n_s__my,0}; - __Pyx_RefNannySetupContext("_cspline_sample2d"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_cspline_sample2d (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__mx,&__pyx_n_s__my,0}; PyObject* values[6] = {0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); @@ -1811,7 +1971,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs values[5] = ((PyObject *)__pyx_n_s__zero); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1822,14 +1983,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_sample2d", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1855,7 +2014,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cspline_sample2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1886,6 +2045,42 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_8_cspline_sample2d(__pyx_self, __pyx_v_R, __pyx_v_C, __pyx_v_X, __pyx_v_Y, __pyx_v_mx, __pyx_v_my); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":115 + * return R + * + * def _cspline_sample2d(ndarray R, ndarray C, X=0, Y=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero'): + * cdef double *r, *x, *y + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8_cspline_sample2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_mx, PyObject *__pyx_v_my) { + double *__pyx_v_r; + double *__pyx_v_x; + double *__pyx_v_y; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_cspline_sample2d", 0); /* "nipy/algorithms/registration/_registration.pyx":119 * cdef double *r, *x, *y @@ -1936,8 +2131,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_multi), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2033,17 +2227,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_4_cs return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":130 - * return R - * - * def _cspline_sample3d(ndarray R, ndarray C, X=0, Y=0, Z=0, # <<<<<<<<<<<<<< - * mx='zero', my='zero', mz='zero'): - * cdef double *r, *x, *y, *z - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d = {__Pyx_NAMESTR("_cspline_sample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_11_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_11_cspline_sample3d = {__Pyx_NAMESTR("_cspline_sample3d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_11_cspline_sample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_11_cspline_sample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; @@ -2052,30 +2239,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs PyObject *__pyx_v_mx = 0; PyObject *__pyx_v_my = 0; PyObject *__pyx_v_mz = 0; - double *__pyx_v_r; - double *__pyx_v_x; - double *__pyx_v_y; - double *__pyx_v_z; - PyArrayMultiIterObject *__pyx_v_multi = 0; - PyArrayObject *__pyx_v_Xa = NULL; - PyArrayObject *__pyx_v_Ya = NULL; - PyArrayObject *__pyx_v_Za = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; - __Pyx_RefNannySetupContext("_cspline_sample3d"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_cspline_sample3d (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; PyObject* values[8] = {0,0,0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); @@ -2085,7 +2253,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs values[7] = ((PyObject *)__pyx_n_s__zero); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -2098,14 +2267,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_sample3d", 0, 2, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2141,7 +2308,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cspline_sample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2176,6 +2343,45 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_10_cspline_sample3d(__pyx_self, __pyx_v_R, __pyx_v_C, __pyx_v_X, __pyx_v_Y, __pyx_v_Z, __pyx_v_mx, __pyx_v_my, __pyx_v_mz); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":130 + * return R + * + * def _cspline_sample3d(ndarray R, ndarray C, X=0, Y=0, Z=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * cdef double *r, *x, *y, *z + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_10_cspline_sample3d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_Z, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz) { + double *__pyx_v_r; + double *__pyx_v_x; + double *__pyx_v_y; + double *__pyx_v_z; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; + PyArrayObject *__pyx_v_Za = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_cspline_sample3d", 0); /* "nipy/algorithms/registration/_registration.pyx":134 * cdef double *r, *x, *y, *z @@ -2238,8 +2444,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_multi), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2352,18 +2557,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_5_cs return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":148 - * - * - * def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, # <<<<<<<<<<<<<< - * mx='zero', my='zero', mz='zero', mt='zero'): - * """ - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d[] = "\n In-place cubic spline sampling. R.dtype must be 'double'. \n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d = {__Pyx_NAMESTR("_cspline_sample4d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_13_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_12_cspline_sample4d[] = "\n In-place cubic spline sampling. R.dtype must be 'double'. \n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_13_cspline_sample4d = {__Pyx_NAMESTR("_cspline_sample4d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_13_cspline_sample4d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_12_cspline_sample4d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_13_cspline_sample4d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_R = 0; PyArrayObject *__pyx_v_C = 0; PyObject *__pyx_v_X = 0; @@ -2374,33 +2572,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs PyObject *__pyx_v_my = 0; PyObject *__pyx_v_mz = 0; PyObject *__pyx_v_mt = 0; - double *__pyx_v_r; - double *__pyx_v_x; - double *__pyx_v_y; - double *__pyx_v_z; - double *__pyx_v_t; - PyArrayMultiIterObject *__pyx_v_multi = 0; - PyArrayObject *__pyx_v_Xa = NULL; - PyArrayObject *__pyx_v_Ya = NULL; - PyArrayObject *__pyx_v_Za = NULL; - PyArrayObject *__pyx_v_Ta = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__T,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,&__pyx_n_s__mt,0}; - __Pyx_RefNannySetupContext("_cspline_sample4d"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_cspline_sample4d (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__R,&__pyx_n_s__C,&__pyx_n_s__X,&__pyx_n_s__Y,&__pyx_n_s__Z,&__pyx_n_s__T,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,&__pyx_n_s__mt,0}; PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_int_0); values[3] = ((PyObject *)__pyx_int_0); @@ -2412,7 +2588,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs values[9] = ((PyObject *)__pyx_n_s__zero); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); @@ -2427,14 +2604,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__R)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_sample4d", 0, 2, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2480,7 +2655,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_sample4d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cspline_sample4d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2519,6 +2694,48 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_R), __pyx_ptype_5numpy_ndarray, 1, "R", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_12_cspline_sample4d(__pyx_self, __pyx_v_R, __pyx_v_C, __pyx_v_X, __pyx_v_Y, __pyx_v_Z, __pyx_v_T, __pyx_v_mx, __pyx_v_my, __pyx_v_mz, __pyx_v_mt); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":148 + * + * + * def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero', mt='zero'): + * """ + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_12_cspline_sample4d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_R, PyArrayObject *__pyx_v_C, PyObject *__pyx_v_X, PyObject *__pyx_v_Y, PyObject *__pyx_v_Z, PyObject *__pyx_v_T, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz, PyObject *__pyx_v_mt) { + double *__pyx_v_r; + double *__pyx_v_x; + double *__pyx_v_y; + double *__pyx_v_z; + double *__pyx_v_t; + PyArrayMultiIterObject *__pyx_v_multi = 0; + PyArrayObject *__pyx_v_Xa = NULL; + PyArrayObject *__pyx_v_Ya = NULL; + PyArrayObject *__pyx_v_Za = NULL; + PyArrayObject *__pyx_v_Ta = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_cspline_sample4d", 0); /* "nipy/algorithms/registration/_registration.pyx":155 * cdef double *r, *x, *y, *z, *t @@ -2593,8 +2810,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_multi), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2724,18 +2940,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_6_cs return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":171 - * - * - * def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, # <<<<<<<<<<<<<< - * mx='zero', my='zero', mz='zero'): - * """ - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d[] = "\n Note that the input transformation Tvox will be re-ordered in C\n convention if needed.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d = {__Pyx_NAMESTR("_cspline_resample3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_15_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_12registration_13_registration_14_cspline_resample3d[] = "\n Perform cubic spline resampling of a 3d input image `im` into a\n grid with shape `dims` according to an affine transform\n represented by a 4x4 matrix `Tvox` that assumes voxel\n coordinates. Boundary conditions on each axis are determined by\n the keyword arguments `mx`, `my` and `mz`, respectively. Possible\n choices are:\n\n 'zero': assume zero intensity outside the target grid\n 'nearest': extrapolate intensity by the closest grid point along the axis\n 'reflect': extrapolate intensity by mirroring the input image along the axis\n\n Note that `Tvox` will be re-ordered in C convention if needed.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_15_cspline_resample3d = {__Pyx_NAMESTR("_cspline_resample3d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_15_cspline_resample3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_12registration_13_registration_14_cspline_resample3d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_15_cspline_resample3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_im = 0; PyObject *__pyx_v_dims = 0; PyArrayObject *__pyx_v_Tvox = 0; @@ -2743,34 +2952,28 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs PyObject *__pyx_v_mx = 0; PyObject *__pyx_v_my = 0; PyObject *__pyx_v_mz = 0; - double *__pyx_v_tvox; - int __pyx_v_cast_integer; - PyObject *__pyx_v_im_resampled = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - int __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__dims,&__pyx_n_s__Tvox,&__pyx_n_s__dtype,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; - __Pyx_RefNannySetupContext("_cspline_resample3d"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_cspline_resample3d (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__im,&__pyx_n_s__dims,&__pyx_n_s__Tvox,&__pyx_n_s__dtype,&__pyx_n_s__mx,&__pyx_n_s__my,&__pyx_n_s__mz,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; + + /* "nipy/algorithms/registration/_registration.pyx":171 + * + * + * def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * """ + */ values[3] = ((PyObject *)Py_None); values[4] = ((PyObject *)__pyx_n_s__zero); values[5] = ((PyObject *)__pyx_n_s__zero); values[6] = ((PyObject *)__pyx_n_s__zero); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); @@ -2782,20 +2985,17 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__im); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__im)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dims)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Tvox)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_cspline_resample3d", 0, 3, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2821,7 +3021,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_cspline_resample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_cspline_resample3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -2852,69 +3052,95 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Tvox); - __Pyx_INCREF(__pyx_v_dtype); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_im), __pyx_ptype_5numpy_ndarray, 1, "im", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Tvox), __pyx_ptype_5numpy_ndarray, 1, "Tvox", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_14_cspline_resample3d(__pyx_self, __pyx_v_im, __pyx_v_dims, __pyx_v_Tvox, __pyx_v_dtype, __pyx_v_mx, __pyx_v_my, __pyx_v_mz); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_14_cspline_resample3d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_im, PyObject *__pyx_v_dims, PyArrayObject *__pyx_v_Tvox, PyObject *__pyx_v_dtype, PyObject *__pyx_v_mx, PyObject *__pyx_v_my, PyObject *__pyx_v_mz) { + double *__pyx_v_tvox; + int __pyx_v_cast_integer; + PyObject *__pyx_v_im_resampled = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_cspline_resample3d", 0); + __Pyx_INCREF((PyObject *)__pyx_v_Tvox); + __Pyx_INCREF(__pyx_v_dtype); - /* "nipy/algorithms/registration/_registration.pyx":181 + /* "nipy/algorithms/registration/_registration.pyx":191 * * # Create output array * if dtype == None: # <<<<<<<<<<<<<< * dtype = im.dtype * im_resampled = np.zeros(tuple(dims), dtype=dtype) */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dtype, Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_dtype, Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "nipy/algorithms/registration/_registration.pyx":182 + /* "nipy/algorithms/registration/_registration.pyx":192 * # Create output array * if dtype == None: * dtype = im.dtype # <<<<<<<<<<<<<< * im_resampled = np.zeros(tuple(dims), dtype=dtype) * */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_im), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_im), __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_dtype); __pyx_v_dtype = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "nipy/algorithms/registration/_registration.pyx":183 + /* "nipy/algorithms/registration/_registration.pyx":193 * if dtype == None: * dtype = im.dtype * im_resampled = np.zeros(tuple(dims), dtype=dtype) # <<<<<<<<<<<<<< * * # Ensure that the Tvox array is C-contiguous (required by the */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_dims); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyTuple_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dtype) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -2922,38 +3148,38 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs __pyx_v_im_resampled = __pyx_t_5; __pyx_t_5 = 0; - /* "nipy/algorithms/registration/_registration.pyx":187 + /* "nipy/algorithms/registration/_registration.pyx":197 * # Ensure that the Tvox array is C-contiguous (required by the * # underlying C routine) * Tvox = np.asarray(Tvox, dtype='double', order='C') # <<<<<<<<<<<<<< * tvox = Tvox.data * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__asarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_v_Tvox)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_Tvox)); __Pyx_GIVEREF(((PyObject *)__pyx_v_Tvox)); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__double)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__double)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_Tvox)); __pyx_v_Tvox = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "nipy/algorithms/registration/_registration.pyx":188 + /* "nipy/algorithms/registration/_registration.pyx":198 * # underlying C routine) * Tvox = np.asarray(Tvox, dtype='double', order='C') * tvox = Tvox.data # <<<<<<<<<<<<<< @@ -2962,20 +3188,22 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs */ __pyx_v_tvox = ((double *)__pyx_v_Tvox->data); - /* "nipy/algorithms/registration/_registration.pyx":191 + /* "nipy/algorithms/registration/_registration.pyx":201 * * # Actual resampling * if dtype.kind == 'i': # <<<<<<<<<<<<<< * cast_integer = 1 * elif dtype.kind == 'u': */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__i), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_n_s__i), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "nipy/algorithms/registration/_registration.pyx":192 + /* "nipy/algorithms/registration/_registration.pyx":202 * # Actual resampling * if dtype.kind == 'i': * cast_integer = 1 # <<<<<<<<<<<<<< @@ -2983,23 +3211,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs * cast_integer = 2 */ __pyx_v_cast_integer = 1; - goto __pyx_L7; + goto __pyx_L4; } - /* "nipy/algorithms/registration/_registration.pyx":193 + /* "nipy/algorithms/registration/_registration.pyx":203 * if dtype.kind == 'i': * cast_integer = 1 * elif dtype.kind == 'u': # <<<<<<<<<<<<<< * cast_integer = 2 * else: */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_3, ((PyObject *)__pyx_n_s__u), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_dtype, __pyx_n_s__kind); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__u), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_2) { - /* "nipy/algorithms/registration/_registration.pyx":194 + /* "nipy/algorithms/registration/_registration.pyx":204 * cast_integer = 1 * elif dtype.kind == 'u': * cast_integer = 2 # <<<<<<<<<<<<<< @@ -3007,11 +3237,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs * cast_integer = 0 */ __pyx_v_cast_integer = 2; - goto __pyx_L7; + goto __pyx_L4; } /*else*/ { - /* "nipy/algorithms/registration/_registration.pyx":196 + /* "nipy/algorithms/registration/_registration.pyx":206 * cast_integer = 2 * else: * cast_integer = 0 # <<<<<<<<<<<<<< @@ -3020,51 +3250,51 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs */ __pyx_v_cast_integer = 0; } - __pyx_L7:; + __pyx_L4:; - /* "nipy/algorithms/registration/_registration.pyx":197 + /* "nipy/algorithms/registration/_registration.pyx":207 * else: * cast_integer = 0 * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, # <<<<<<<<<<<<<< * modes[mx], modes[my], modes[mz]) * */ - if (!(likely(((__pyx_v_im_resampled) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_im_resampled, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_im_resampled) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_im_resampled, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = __pyx_v_im_resampled; __Pyx_INCREF(__pyx_t_3); - /* "nipy/algorithms/registration/_registration.pyx":198 + /* "nipy/algorithms/registration/_registration.pyx":208 * cast_integer = 0 * cubic_spline_resample3d(im_resampled, im, tvox, cast_integer, * modes[mx], modes[my], modes[mz]) # <<<<<<<<<<<<<< * * return im_resampled */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mx); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_v_my); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_t_5, __pyx_v_my); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__modes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mz); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_t_1, __pyx_v_mz); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; cubic_spline_resample3d(((PyArrayObject *)__pyx_t_3), __pyx_v_im, __pyx_v_tvox, __pyx_v_cast_integer, __pyx_t_6, __pyx_t_7, __pyx_t_8); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "nipy/algorithms/registration/_registration.pyx":200 + /* "nipy/algorithms/registration/_registration.pyx":210 * modes[mx], modes[my], modes[mz]) * * return im_resampled # <<<<<<<<<<<<<< @@ -3094,40 +3324,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_7_cs return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":203 - * - * - * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< - * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': - * raise ValueError('%s array should be double C-contiguous' % xname) - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_8check_array = {__Pyx_NAMESTR("check_array"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_17check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_17check_array = {__Pyx_NAMESTR("check_array"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_17check_array, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_17check_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_x = 0; int __pyx_v_dim; int __pyx_v_exp_dim; PyObject *__pyx_v_xname = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__dim,&__pyx_n_s__exp_dim,&__pyx_n_s__xname,0}; - __Pyx_RefNannySetupContext("check_array"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("check_array (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__dim,&__pyx_n_s__exp_dim,&__pyx_n_s__xname,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -3136,32 +3350,28 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8che default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__dim)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exp_dim); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__exp_dim)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xname); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xname)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "check_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "check_array") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -3172,40 +3382,72 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8che values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_x = ((PyArrayObject *)values[0]); - __pyx_v_dim = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_exp_dim = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_exp_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dim = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_exp_dim = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_exp_dim == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_xname = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("check_array", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("nipy.algorithms.registration._registration.check_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_x), __pyx_ptype_5numpy_ndarray, 1, "x", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_16check_array(__pyx_self, __pyx_v_x, __pyx_v_dim, __pyx_v_exp_dim, __pyx_v_xname); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":213 + * + * + * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< + * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': + * raise ValueError('%s array should be double C-contiguous' % xname) + */ - /* "nipy/algorithms/registration/_registration.pyx":204 +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_16check_array(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_x, int __pyx_v_dim, int __pyx_v_exp_dim, PyObject *__pyx_v_xname) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("check_array", 0); + + /* "nipy/algorithms/registration/_registration.pyx":214 * * def check_array(ndarray x, int dim, int exp_dim, xname): * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': # <<<<<<<<<<<<<< * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: */ - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (!__pyx_t_4) { - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_x), __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -3213,31 +3455,31 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8che } if (__pyx_t_3) { - /* "nipy/algorithms/registration/_registration.pyx":205 + /* "nipy/algorithms/registration/_registration.pyx":215 * def check_array(ndarray x, int dim, int exp_dim, xname): * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': * raise ValueError('%s array should be double C-contiguous' % xname) # <<<<<<<<<<<<<< * if not dim == exp_dim: * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) */ - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_xname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_v_xname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "nipy/algorithms/registration/_registration.pyx":206 + /* "nipy/algorithms/registration/_registration.pyx":216 * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: # <<<<<<<<<<<<<< @@ -3247,45 +3489,45 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8che __pyx_t_3 = (!(__pyx_v_dim == __pyx_v_exp_dim)); if (__pyx_t_3) { - /* "nipy/algorithms/registration/_registration.pyx":207 + /* "nipy/algorithms/registration/_registration.pyx":217 * raise ValueError('%s array should be double C-contiguous' % xname) * if not dim == exp_dim: * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) # <<<<<<<<<<<<<< * * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyInt_FromLong(__pyx_v_exp_dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_dim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_exp_dim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_xname); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_xname); __Pyx_GIVEREF(__pyx_v_xname); - PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -3301,38 +3543,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_8che return __pyx_r; } -/* "nipy/algorithms/registration/_registration.pyx":209 - * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) - * - * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< - * - * check_array(xyz, xyz.shape[1], 3, 'xyz') - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine = {__Pyx_NAMESTR("_apply_polyaffine"), (PyCFunction)__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; -static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_19_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_10algorithms_12registration_13_registration_19_apply_polyaffine = {__Pyx_NAMESTR("_apply_polyaffine"), (PyCFunction)__pyx_pw_4nipy_10algorithms_12registration_13_registration_19_apply_polyaffine, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_10algorithms_12registration_13_registration_19_apply_polyaffine(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_xyz = 0; PyArrayObject *__pyx_v_centers = 0; PyArrayObject *__pyx_v_affines = 0; PyArrayObject *__pyx_v_sigma = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__xyz,&__pyx_n_s__centers,&__pyx_n_s__affines,&__pyx_n_s__sigma,0}; - __Pyx_RefNannySetupContext("_apply_polyaffine"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_apply_polyaffine (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__xyz,&__pyx_n_s__centers,&__pyx_n_s__affines,&__pyx_n_s__sigma,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -3341,32 +3569,28 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xyz); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xyz)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__centers)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__affines); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__affines)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sigma)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_apply_polyaffine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_apply_polyaffine") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -3383,30 +3607,58 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_apply_polyaffine", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("nipy.algorithms.registration._registration._apply_polyaffine", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_affines), __pyx_ptype_5numpy_ndarray, 1, "affines", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sigma), __pyx_ptype_5numpy_ndarray, 1, "sigma", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xyz), __pyx_ptype_5numpy_ndarray, 1, "xyz", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_centers), __pyx_ptype_5numpy_ndarray, 1, "centers", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_affines), __pyx_ptype_5numpy_ndarray, 1, "affines", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sigma), __pyx_ptype_5numpy_ndarray, 1, "sigma", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_12registration_13_registration_18_apply_polyaffine(__pyx_self, __pyx_v_xyz, __pyx_v_centers, __pyx_v_affines, __pyx_v_sigma); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/registration/_registration.pyx":219 + * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) + * + * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< + * + * check_array(xyz, xyz.shape[1], 3, 'xyz') + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_18_apply_polyaffine(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_xyz, PyArrayObject *__pyx_v_centers, PyArrayObject *__pyx_v_affines, PyArrayObject *__pyx_v_sigma) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_apply_polyaffine", 0); - /* "nipy/algorithms/registration/_registration.pyx":211 + /* "nipy/algorithms/registration/_registration.pyx":221 * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): * * check_array(xyz, xyz.shape[1], 3, 'xyz') # <<<<<<<<<<<<<< * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xyz->dimensions[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xyz->dimensions[1])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_xyz)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_xyz)); __Pyx_GIVEREF(((PyObject *)__pyx_v_xyz)); @@ -3419,25 +3671,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__xyz)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xyz)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "nipy/algorithms/registration/_registration.pyx":212 + /* "nipy/algorithms/registration/_registration.pyx":222 * * check_array(xyz, xyz.shape[1], 3, 'xyz') * check_array(centers, centers.shape[1], 3, 'centers') # <<<<<<<<<<<<<< * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_centers->dimensions[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_centers->dimensions[1])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_centers)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_centers)); __Pyx_GIVEREF(((PyObject *)__pyx_v_centers)); @@ -3450,25 +3702,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap PyTuple_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__centers)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__centers)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "nipy/algorithms/registration/_registration.pyx":213 + /* "nipy/algorithms/registration/_registration.pyx":223 * check_array(xyz, xyz.shape[1], 3, 'xyz') * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') # <<<<<<<<<<<<<< * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_affines->dimensions[1])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_affines->dimensions[1])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_affines)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_affines)); __Pyx_GIVEREF(((PyObject *)__pyx_v_affines)); @@ -3481,25 +3733,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap PyTuple_SET_ITEM(__pyx_t_2, 3, ((PyObject *)__pyx_n_s__affines)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__affines)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "nipy/algorithms/registration/_registration.pyx":214 + /* "nipy/algorithms/registration/_registration.pyx":224 * check_array(centers, centers.shape[1], 3, 'centers') * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') # <<<<<<<<<<<<<< * if not centers.shape[0] == affines.shape[0]: * raise ValueError('centers and affines arrays should have same shape[0]') */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__check_array); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sigma), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_sigma), __pyx_n_s__size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_sigma)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_sigma)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sigma)); @@ -3512,13 +3764,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap PyTuple_SET_ITEM(__pyx_t_3, 3, ((PyObject *)__pyx_n_s__sigma)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sigma)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "nipy/algorithms/registration/_registration.pyx":215 + /* "nipy/algorithms/registration/_registration.pyx":225 * check_array(affines, affines.shape[1], 12, 'affines') * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: # <<<<<<<<<<<<<< @@ -3528,23 +3780,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap __pyx_t_4 = (!((__pyx_v_centers->dimensions[0]) == (__pyx_v_affines->dimensions[0]))); if (__pyx_t_4) { - /* "nipy/algorithms/registration/_registration.pyx":216 + /* "nipy/algorithms/registration/_registration.pyx":226 * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: * raise ValueError('centers and affines arrays should have same shape[0]') # <<<<<<<<<<<<<< * * apply_polyaffine(xyz, centers, affines, sigma) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; - /* "nipy/algorithms/registration/_registration.pyx":218 + /* "nipy/algorithms/registration/_registration.pyx":228 * raise ValueError('centers and affines arrays should have same shape[0]') * * apply_polyaffine(xyz, centers, affines, sigma) # <<<<<<<<<<<<<< @@ -3565,7 +3817,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap return __pyx_r; } -/* "numpy.pxd":190 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -3573,8 +3836,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12registration_13_registration_9_ap * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -3599,13 +3861,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -3616,11 +3878,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3629,7 +3891,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3638,16 +3900,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3657,7 +3919,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3665,11 +3927,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3678,9 +3940,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3690,37 +3952,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3730,46 +3992,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -3778,7 +4040,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -3787,7 +4049,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -3796,7 +4058,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -3805,7 +4067,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -3816,49 +4078,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3867,25 +4129,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3894,17 +4156,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3913,7 +4177,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3929,7 +4193,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3941,49 +4205,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -3994,10 +4259,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -4014,24 +4279,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -4040,10 +4305,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -4053,10 +4318,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -4066,10 +4331,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -4079,10 +4344,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -4092,10 +4357,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -4105,10 +4370,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -4118,10 +4383,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -4131,10 +4396,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -4144,10 +4409,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -4157,10 +4422,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -4170,10 +4435,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -4183,10 +4448,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -4196,10 +4461,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -4209,10 +4474,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -4222,10 +4487,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -4235,10 +4500,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -4248,37 +4513,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -4287,7 +4552,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -4296,57 +4561,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -4371,31 +4636,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4403,11 +4676,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4417,7 +4690,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4425,14 +4698,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4447,9 +4720,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -4457,7 +4730,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4475,7 +4748,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4490,9 +4763,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -4500,7 +4773,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4518,7 +4791,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4533,9 +4806,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -4543,7 +4816,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4561,7 +4834,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -4576,9 +4849,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -4586,7 +4859,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4604,7 +4877,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4619,9 +4892,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -4629,7 +4902,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4647,7 +4920,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -4670,18 +4943,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4690,7 +4964,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4699,7 +4973,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -4707,31 +4981,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -4740,20 +5019,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -4761,99 +5069,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_17), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4861,16 +5168,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4879,7 +5185,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -4888,430 +5194,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_15), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -5319,25 +5608,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -5366,7 +5655,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -5378,9 +5667,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5390,7 +5679,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5402,7 +5691,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5411,7 +5700,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -5422,7 +5711,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5431,7 +5720,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5443,7 +5732,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5455,9 +5744,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5467,7 +5756,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5482,7 +5771,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -5527,7 +5816,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, {&__pyx_kp_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 0}, - {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, + {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, + {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, @@ -5539,11 +5829,15 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__R, __pyx_k__R, sizeof(__pyx_k__R), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, + {&__pyx_n_s__Ta, __pyx_k__Ta, sizeof(__pyx_k__Ta), 0, 0, 1, 1}, {&__pyx_n_s__Tvox, __pyx_k__Tvox, sizeof(__pyx_k__Tvox), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s__Xa, __pyx_k__Xa, sizeof(__pyx_k__Xa), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, + {&__pyx_n_s__Ya, __pyx_k__Ya, sizeof(__pyx_k__Ya), 0, 0, 1, 1}, {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, + {&__pyx_n_s__Za, __pyx_k__Za, sizeof(__pyx_k__Za), 0, 0, 1, 1}, {&__pyx_n_s___L1_moments, __pyx_k___L1_moments, sizeof(__pyx_k___L1_moments), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, @@ -5559,40 +5853,56 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__affines, __pyx_k__affines, sizeof(__pyx_k__affines), 0, 0, 1, 1}, {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__cast_integer, __pyx_k__cast_integer, sizeof(__pyx_k__cast_integer), 0, 0, 1, 1}, {&__pyx_n_s__centers, __pyx_k__centers, sizeof(__pyx_k__centers), 0, 0, 1, 1}, {&__pyx_n_s__check_array, __pyx_k__check_array, sizeof(__pyx_k__check_array), 0, 0, 1, 1}, + {&__pyx_n_s__clampI, __pyx_k__clampI, sizeof(__pyx_k__clampI), 0, 0, 1, 1}, + {&__pyx_n_s__clampJ, __pyx_k__clampJ, sizeof(__pyx_k__clampJ), 0, 0, 1, 1}, + {&__pyx_n_s__dev, __pyx_k__dev, sizeof(__pyx_k__dev), 0, 0, 1, 1}, {&__pyx_n_s__dim, __pyx_k__dim, sizeof(__pyx_k__dim), 0, 0, 1, 1}, {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__exp_dim, __pyx_k__exp_dim, sizeof(__pyx_k__exp_dim), 0, 0, 1, 1}, {&__pyx_n_s__flags, __pyx_k__flags, sizeof(__pyx_k__flags), 0, 0, 1, 1}, + {&__pyx_n_s__h, __pyx_k__h, sizeof(__pyx_k__h), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__im, __pyx_k__im, sizeof(__pyx_k__im), 0, 0, 1, 1}, {&__pyx_n_s__imJ, __pyx_k__imJ, sizeof(__pyx_k__imJ), 0, 0, 1, 1}, + {&__pyx_n_s__im_resampled, __pyx_k__im_resampled, sizeof(__pyx_k__im_resampled), 0, 0, 1, 1}, {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, {&__pyx_n_s__iterI, __pyx_k__iterI, sizeof(__pyx_k__iterI), 0, 0, 1, 1}, {&__pyx_n_s__kind, __pyx_k__kind, sizeof(__pyx_k__kind), 0, 0, 1, 1}, + {&__pyx_n_s__median, __pyx_k__median, sizeof(__pyx_k__median), 0, 0, 1, 1}, {&__pyx_n_s__mode, __pyx_k__mode, sizeof(__pyx_k__mode), 0, 0, 1, 1}, {&__pyx_n_s__modes, __pyx_k__modes, sizeof(__pyx_k__modes), 0, 0, 1, 1}, {&__pyx_n_s__mt, __pyx_k__mt, sizeof(__pyx_k__mt), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, {&__pyx_n_s__mx, __pyx_k__mx, sizeof(__pyx_k__mx), 0, 0, 1, 1}, {&__pyx_n_s__my, __pyx_k__my, sizeof(__pyx_k__my), 0, 0, 1, 1}, {&__pyx_n_s__mz, __pyx_k__mz, sizeof(__pyx_k__mz), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, {&__pyx_n_s__nearest, __pyx_k__nearest, sizeof(__pyx_k__nearest), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__reflect, __pyx_k__reflect, sizeof(__pyx_k__reflect), 0, 0, 1, 1}, {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__ret, __pyx_k__ret, sizeof(__pyx_k__ret), 0, 0, 1, 1}, {&__pyx_n_s__sigma, __pyx_k__sigma, sizeof(__pyx_k__sigma), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__tvox, __pyx_k__tvox, sizeof(__pyx_k__tvox), 0, 0, 1, 1}, {&__pyx_n_s__u, __pyx_k__u, sizeof(__pyx_k__u), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {&__pyx_n_s__xname, __pyx_k__xname, sizeof(__pyx_k__xname), 0, 0, 1, 1}, {&__pyx_n_s__xyz, __pyx_k__xyz, sizeof(__pyx_k__xyz), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {&__pyx_n_s__zero, __pyx_k__zero, sizeof(__pyx_k__zero), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} @@ -5600,7 +5910,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -5608,7 +5918,7 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "nipy/algorithms/registration/_registration.pyx":73 * ret = joint_histogram(H, clampI, clampJ, iterI, imJ, Tvox, interp) @@ -5618,7 +5928,7 @@ static int __Pyx_InitCachedConstants(void) { * return */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -5632,109 +5942,505 @@ static int __Pyx_InitCachedConstants(void) { * return n[0], median[0], dev[0] */ __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "nipy/algorithms/registration/_registration.pyx":216 + /* "nipy/algorithms/registration/_registration.pyx":226 * check_array(sigma, sigma.size, 3, 'sigma') * if not centers.shape[0] == affines.shape[0]: * raise ValueError('centers and affines arrays should have same shape[0]') # <<<<<<<<<<<<<< * * apply_polyaffine(xyz, centers, affines, sigma) */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); - PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_20); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); + PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + + /* "nipy/algorithms/registration/_registration.pyx":57 + * + * + * def _joint_histogram(ndarray H, flatiter iterI, ndarray imJ, ndarray Tvox, long interp): # <<<<<<<<<<<<<< + * """ + * Compute the joint histogram given a transformation trial. + */ + __pyx_k_tuple_23 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__H)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__H)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__H)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__iterI)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__iterI)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iterI)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__imJ)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__imJ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__imJ)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Tvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__Tvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Tvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__interp)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__interp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__interp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__h)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__h)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__h)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__tvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__clampI)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__clampI)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clampI)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__clampJ)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__clampJ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__clampJ)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ret)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 9, ((PyObject *)__pyx_n_s__ret)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ret)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(5, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___joint_histogram, 57, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":78 + * + * + * def _L1_moments(ndarray H): # <<<<<<<<<<<<<< + * """ + * Compute L1 moments of order 0, 1 and 2 of a one-dimensional + */ + __pyx_k_tuple_27 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_INCREF(((PyObject *)__pyx_n_s__H)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__H)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__H)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__median)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 2, ((PyObject *)__pyx_n_s__median)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__median)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dev)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 3, ((PyObject *)__pyx_n_s__dev)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dev)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ret)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 4, ((PyObject *)__pyx_n_s__ret)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ret)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_k_codeobj_28 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___L1_moments, 78, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":94 + * + * + * def _cspline_transform(ndarray x): # <<<<<<<<<<<<<< + * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) + * cubic_spline_transform(c, x) + */ + __pyx_k_tuple_29 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 2, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_transform, 94, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":103 + * return np.reshape(in_arr, shape).astype(np.double) + * + * def _cspline_sample1d(ndarray R, ndarray C, X=0, mode='zero'): # <<<<<<<<<<<<<< + * cdef double *r, *x + * cdef broadcast multi + */ + __pyx_k_tuple_31 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_INCREF(((PyObject *)__pyx_n_s__R)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__R)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 1, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mode)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 3, ((PyObject *)__pyx_n_s__mode)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mode)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 4, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 5, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 6, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xa)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 7, ((PyObject *)__pyx_n_s__Xa)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xa)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(4, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_sample1d, 103, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":115 + * return R + * + * def _cspline_sample2d(ndarray R, ndarray C, X=0, Y=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero'): + * cdef double *r, *x, *y + */ + __pyx_k_tuple_33 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); + __Pyx_INCREF(((PyObject *)__pyx_n_s__R)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_n_s__R)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 1, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 3, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mx)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 4, ((PyObject *)__pyx_n_s__mx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__my)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 5, ((PyObject *)__pyx_n_s__my)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__my)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 6, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 7, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 8, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 9, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xa)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 10, ((PyObject *)__pyx_n_s__Xa)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xa)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Ya)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 11, ((PyObject *)__pyx_n_s__Ya)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Ya)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(6, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_sample2d, 115, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":130 + * return R + * + * def _cspline_sample3d(ndarray R, ndarray C, X=0, Y=0, Z=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * cdef double *r, *x, *y, *z + */ + __pyx_k_tuple_35 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_35); + __Pyx_INCREF(((PyObject *)__pyx_n_s__R)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_n_s__R)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 1, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 3, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 4, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mx)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 5, ((PyObject *)__pyx_n_s__mx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__my)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 6, ((PyObject *)__pyx_n_s__my)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__my)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mz)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 7, ((PyObject *)__pyx_n_s__mz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 8, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 9, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 10, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 11, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 12, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xa)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 13, ((PyObject *)__pyx_n_s__Xa)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xa)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Ya)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 14, ((PyObject *)__pyx_n_s__Ya)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Ya)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Za)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 15, ((PyObject *)__pyx_n_s__Za)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Za)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(8, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_sample3d, 130, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "numpy.pxd":795 + /* "nipy/algorithms/registration/_registration.pyx":148 * - * if (end - f) - (new_offset - offset[0]) < 15: - * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * def _cspline_sample4d(ndarray R, ndarray C, X=0, Y=0, Z=0, T=0, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero', mt='zero'): + * """ */ - __pyx_k_tuple_17 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_17)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_tuple_37 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); + __Pyx_INCREF(((PyObject *)__pyx_n_s__R)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__R)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__R)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 1, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 3, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 4, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 5, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mx)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 6, ((PyObject *)__pyx_n_s__mx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__my)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 7, ((PyObject *)__pyx_n_s__my)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__my)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mz)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 8, ((PyObject *)__pyx_n_s__mz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mt)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 9, ((PyObject *)__pyx_n_s__mt)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mt)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 10, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 11, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 12, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 13, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 14, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 15, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xa)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 16, ((PyObject *)__pyx_n_s__Xa)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xa)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Ya)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 17, ((PyObject *)__pyx_n_s__Ya)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Ya)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Za)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 18, ((PyObject *)__pyx_n_s__Za)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Za)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Ta)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 19, ((PyObject *)__pyx_n_s__Ta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Ta)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(10, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_sample4d, 148, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): - * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< - * # One could encode it in the format string and have Cython - * # complain instead, BUT: < and > in format strings also imply + /* "nipy/algorithms/registration/_registration.pyx":171 + * + * + * def _cspline_resample3d(ndarray im, dims, ndarray Tvox, dtype=None, # <<<<<<<<<<<<<< + * mx='zero', my='zero', mz='zero'): + * """ */ - __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); - PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __pyx_k_tuple_39 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); + __Pyx_INCREF(((PyObject *)__pyx_n_s__im)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__im)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__im)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Tvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, ((PyObject *)__pyx_n_s__Tvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Tvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dtype)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, ((PyObject *)__pyx_n_s__dtype)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dtype)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mx)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 4, ((PyObject *)__pyx_n_s__mx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__my)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 5, ((PyObject *)__pyx_n_s__my)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__my)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mz)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 6, ((PyObject *)__pyx_n_s__mz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 7, ((PyObject *)__pyx_n_s__tvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__cast_integer)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 8, ((PyObject *)__pyx_n_s__cast_integer)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cast_integer)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__im_resampled)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 9, ((PyObject *)__pyx_n_s__im_resampled)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__im_resampled)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_codeobj_40 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___cspline_resample3d, 171, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "numpy.pxd":819 - * t = child.type_num - * if end - f < 5: - * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + /* "nipy/algorithms/registration/_registration.pyx":213 * - * # Until ticket #99 is fixed, use integers to avoid warnings + * + * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< + * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': + * raise ValueError('%s array should be double C-contiguous' % xname) */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); - PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + __pyx_k_tuple_41 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dim)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 1, ((PyObject *)__pyx_n_s__dim)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dim)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__exp_dim)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 2, ((PyObject *)__pyx_n_s__exp_dim)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__exp_dim)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__xname)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 3, ((PyObject *)__pyx_n_s__xname)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xname)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_codeobj_42 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s__check_array, 213, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/registration/_registration.pyx":219 + * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) + * + * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< + * + * check_array(xyz, xyz.shape[1], 3, 'xyz') + */ + __pyx_k_tuple_43 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_43); + __Pyx_INCREF(((PyObject *)__pyx_n_s__xyz)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_n_s__xyz)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xyz)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__centers)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 1, ((PyObject *)__pyx_n_s__centers)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__centers)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__affines)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 2, ((PyObject *)__pyx_n_s__affines)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__affines)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__sigma)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 3, ((PyObject *)__pyx_n_s__sigma)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sigma)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); + __pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_25, __pyx_n_s___apply_polyaffine, 219, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5774,12 +6480,18 @@ PyMODINIT_FUNC PyInit__registration(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__registration(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__registration(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -5790,16 +6502,23 @@ PyMODINIT_FUNC PyInit__registration(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_registration"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_21), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_registration"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_21), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.registration._registration")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.registration._registration", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5815,11 +6534,18 @@ PyMODINIT_FUNC PyInit__registration(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -5903,7 +6629,7 @@ PyMODINIT_FUNC PyInit__registration(void) * """ * Compute the joint histogram given a transformation trial. */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration__joint_histogram, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_joint_histogram, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___joint_histogram, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5915,7 +6641,7 @@ PyMODINIT_FUNC PyInit__registration(void) * """ * Compute L1 moments of order 0, 1 and 2 of a one-dimensional */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_1_L1_moments, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_L1_moments, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___L1_moments, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5927,7 +6653,7 @@ PyMODINIT_FUNC PyInit__registration(void) * c = np.zeros([x.shape[i] for i in range(x.ndim)], dtype=np.double) * cubic_spline_transform(c, x) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_2_cspline_transform, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_transform, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_transform, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5939,7 +6665,7 @@ PyMODINIT_FUNC PyInit__registration(void) * cdef double *r, *x * cdef broadcast multi */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_3_cspline_sample1d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_sample1d, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5951,7 +6677,7 @@ PyMODINIT_FUNC PyInit__registration(void) * mx='zero', my='zero'): * cdef double *r, *x, *y */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_4_cspline_sample2d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_cspline_sample2d, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5963,7 +6689,7 @@ PyMODINIT_FUNC PyInit__registration(void) * mx='zero', my='zero', mz='zero'): * cdef double *r, *x, *y, *z */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_5_cspline_sample3d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_11_cspline_sample3d, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5975,7 +6701,7 @@ PyMODINIT_FUNC PyInit__registration(void) * mx='zero', my='zero', mz='zero', mt='zero'): * """ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_6_cspline_sample4d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_13_cspline_sample4d, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_sample4d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5987,33 +6713,33 @@ PyMODINIT_FUNC PyInit__registration(void) * mx='zero', my='zero', mz='zero'): * """ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_7_cspline_resample3d, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_15_cspline_resample3d, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___cspline_resample3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "nipy/algorithms/registration/_registration.pyx":203 + /* "nipy/algorithms/registration/_registration.pyx":213 * * * def check_array(ndarray x, int dim, int exp_dim, xname): # <<<<<<<<<<<<<< * if not x.flags['C_CONTIGUOUS'] or not x.dtype=='double': * raise ValueError('%s array should be double C-contiguous' % xname) */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_8check_array, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_17check_array, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__check_array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__check_array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "nipy/algorithms/registration/_registration.pyx":209 + /* "nipy/algorithms/registration/_registration.pyx":219 * raise ValueError('%s has size %d in last dimension, %d expected' % (xname, dim, exp_dim)) * * def _apply_polyaffine(ndarray xyz, ndarray centers, ndarray affines, ndarray sigma): # <<<<<<<<<<<<<< * * check_array(xyz, xyz.shape[1], 3, 'xyz') */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_9_apply_polyaffine, NULL, __pyx_n_s_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_12registration_13_registration_19_apply_polyaffine, NULL, __pyx_n_s_26); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s___apply_polyaffine, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___apply_polyaffine, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "nipy/algorithms/registration/_registration.pyx":1 @@ -6026,7 +6752,7 @@ PyMODINIT_FUNC PyInit__registration(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -6052,7 +6778,6 @@ PyMODINIT_FUNC PyInit__registration(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -6093,7 +6818,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -6105,7 +6829,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -6119,7 +6843,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -6135,55 +6859,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -6223,9 +6969,9 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -6235,55 +6981,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -6306,7 +7057,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6315,10 +7065,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -6328,7 +7077,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -6337,13 +7085,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -6360,14 +7131,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -6377,8 +7143,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -6395,29 +7161,64 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -6446,12 +7247,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -6493,68 +7315,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { } } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyBytes_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); - else - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); - } else { - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { /* as done by PyObject_RichCompareBool(); also catches the (interned) empty string */ - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyUnicode_AS_UNICODE(s1)[0] == PyUnicode_AS_UNICODE(s2)[0]); - else - return (PyUnicode_AS_UNICODE(s1)[0] != PyUnicode_AS_UNICODE(s2)[0]); - } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -7214,6 +7974,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -7223,15 +8000,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -7247,7 +8019,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -7257,7 +8029,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -7271,51 +8043,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -7326,28 +8152,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -7355,11 +8198,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7394,6 +8235,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/nipy/algorithms/segmentation/_segmentation.c b/nipy/algorithms/segmentation/_segmentation.c index e02a86294e..e6052bda5c 100644 --- a/nipy/algorithms/segmentation/_segmentation.c +++ b/nipy/algorithms/segmentation/_segmentation.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.16 on Fri Jul 20 15:55:43 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:28 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -11,7 +11,6 @@ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -23,22 +22,18 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif - #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 @@ -46,28 +41,28 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif - -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCFunction_Call PyObject_Call -#else - #define __Pyx_PyCFunction_Call PyCFunction_Call -#endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -75,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -89,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -101,11 +94,9 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) - typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ @@ -115,31 +106,30 @@ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - - -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -147,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -166,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -174,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -193,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -206,7 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -225,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -239,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -248,6 +228,7 @@ #define __Pyx_DOCSTR(n) (n) #endif + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) @@ -329,7 +310,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ @@ -380,9 +365,10 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "_segmentation.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":722 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -391,7 +377,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":723 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -400,7 +386,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":724 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -409,7 +395,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":725 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -418,7 +404,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":729 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -427,7 +413,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":730 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -436,7 +422,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":731 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -445,7 +431,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":732 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -454,7 +440,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":736 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -463,7 +449,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":737 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -472,7 +458,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":746 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -481,7 +467,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":747 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -490,7 +476,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":748 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -499,7 +485,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":750 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -508,7 +494,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":751 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -517,7 +503,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":752 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -526,7 +512,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":754 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -535,7 +521,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":755 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -544,7 +530,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":757 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -553,7 +539,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":758 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -562,7 +548,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":759 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -593,7 +579,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /*--- Type declarations ---*/ -/* "numpy.pxd":761 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -602,7 +588,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":762 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -611,7 +597,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":763 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -620,7 +606,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":765 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -709,42 +695,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -760,39 +751,38 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) Py_INCREF(r); return r; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } return m->sq_item(o, i); } } +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -#include +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -934,10 +924,10 @@ static int __Pyx_check_binary_version(void); #endif #endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ - static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + typedef struct { int code_line; PyCodeObject* code_object; @@ -966,6 +956,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1125,12 +1120,11 @@ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_1_ve PyObject *__pyx_v_U = 0; int __pyx_v_ngb_size; double __pyx_v_beta; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ppm,&__pyx_n_s__ref,&__pyx_n_s__XYZ,&__pyx_n_s__U,&__pyx_n_s__ngb_size,&__pyx_n_s__beta,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_ve_step (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ppm,&__pyx_n_s__ref,&__pyx_n_s__XYZ,&__pyx_n_s__U,&__pyx_n_s__ngb_size,&__pyx_n_s__beta,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1148,36 +1142,30 @@ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_1_ve kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ppm); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ppm)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ref)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_ve_step", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__XYZ); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__XYZ)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_ve_step", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__U); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__U)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_ve_step", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_ve_step", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_ve_step", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1255,8 +1243,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ if (!__pyx_t_4) { __pyx_t_2 = PyObject_GetAttr(__pyx_v_ppm, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -1271,10 +1261,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * if not ref.flags['C_CONTIGUOUS'] or not ref.dtype=='double': * raise ValueError('ref array should be double C-contiguous') */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } @@ -1287,18 +1277,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * raise ValueError('ref array should be double C-contiguous') * if not XYZ.flags['C_CONTIGUOUS'] or not XYZ.dtype=='intp': */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (!__pyx_t_4) { - __pyx_t_1 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_ref, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; @@ -1341,8 +1333,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ if (!__pyx_t_4) { __pyx_t_2 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__intp), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__intp), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -1357,10 +1351,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * if not XYZ.shape[1] == 3: * raise ValueError('XYZ array should be 3D') */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } @@ -1373,16 +1367,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * raise ValueError('XYZ array should be 3D') * if not U.flags['C_CONTIGUOUS'] or not U.dtype=='double': */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = (!__pyx_t_3); if (__pyx_t_4) { @@ -1393,10 +1386,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * if not U.flags['C_CONTIGUOUS'] or not U.dtype=='double': * raise ValueError('U array should be double C-contiguous') */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } @@ -1409,18 +1402,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ * raise ValueError('U array should be double C-contiguous') * if not ppm.shape[-1] == ref.shape[-1]: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_U, __pyx_n_s__flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_U, __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = (!__pyx_t_4); if (!__pyx_t_3) { - __pyx_t_1 = PyObject_GetAttr(__pyx_v_U, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_U, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_4); __pyx_t_4 = __pyx_t_5; @@ -1462,8 +1457,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation__ve_ __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_t_6, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1528,12 +1522,11 @@ static PyMethodDef __pyx_mdef_4nipy_10algorithms_12segmentation_13_segmentation_ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_3_make_edges(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_mask = 0; int __pyx_v_ngb_size; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mask,&__pyx_n_s__ngb_size,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_make_edges (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mask,&__pyx_n_s__ngb_size,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1547,12 +1540,10 @@ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_3_ma kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_make_edges", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1621,8 +1612,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_2_ma if (!__pyx_t_4) { __pyx_t_2 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__intp), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__intp), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -1637,10 +1630,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_2_ma * * return make_edges(mask, ngb_size) */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } @@ -1655,13 +1648,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_2_ma */ __Pyx_XDECREF(__pyx_r); if (!(likely(((__pyx_v_mask) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_mask, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __pyx_v_mask; - __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((PyObject *)make_edges(((PyArrayObject *)__pyx_t_2), __pyx_v_ngb_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_1 = __pyx_v_mask; + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = ((PyObject *)make_edges(((PyArrayObject *)__pyx_t_1), __pyx_v_ngb_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -1685,12 +1678,11 @@ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_5_in PyObject *__pyx_v_XYZ = 0; PyObject *__pyx_v_U = 0; int __pyx_v_ngb_size; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ppm,&__pyx_n_s__XYZ,&__pyx_n_s__U,&__pyx_n_s__ngb_size,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_interaction_energy (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__ppm,&__pyx_n_s__XYZ,&__pyx_n_s__U,&__pyx_n_s__ngb_size,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1706,24 +1698,20 @@ static PyObject *__pyx_pw_4nipy_10algorithms_12segmentation_13_segmentation_5_in kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ppm); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ppm)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__XYZ); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__XYZ)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interaction_energy", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__U); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__U)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interaction_energy", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ngb_size)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_interaction_energy", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1796,8 +1784,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in if (!__pyx_t_4) { __pyx_t_2 = PyObject_GetAttr(__pyx_v_ppm, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; } else { @@ -1812,10 +1802,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in * if not XYZ.flags['C_CONTIGUOUS'] or not XYZ.dtype=='intp': * raise ValueError('XYZ array should be intp C-contiguous') */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } @@ -1828,18 +1818,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in * raise ValueError('XYZ array should be intp C-contiguous') * if not XYZ.shape[1] == 3: */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__flags); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__flags); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__C_CONTIGUOUS)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = (!__pyx_t_3); if (!__pyx_t_4) { - __pyx_t_1 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__intp), Py_EQ); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_XYZ, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__intp), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_3); __pyx_t_3 = __pyx_t_5; @@ -1876,8 +1868,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -1918,8 +1909,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in if (!__pyx_t_3) { __pyx_t_2 = PyObject_GetAttr(__pyx_v_U, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Equals(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__double), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = (!__pyx_t_4); __pyx_t_4 = __pyx_t_5; } else { @@ -1934,10 +1927,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in * * return interaction_energy(ppm, XYZ, U, */ - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } @@ -1956,10 +1949,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in * return interaction_energy(ppm, XYZ, U, * ngb_size) # <<<<<<<<<<<<<< */ - __pyx_t_2 = PyFloat_FromDouble(interaction_energy(((PyArrayObject *)__pyx_v_ppm), ((PyArrayObject *)__pyx_v_XYZ), ((PyArrayObject *)__pyx_v_U), __pyx_v_ngb_size)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyFloat_FromDouble(interaction_energy(((PyArrayObject *)__pyx_v_ppm), ((PyArrayObject *)__pyx_v_XYZ), ((PyArrayObject *)__pyx_v_U), __pyx_v_ngb_size)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -1976,8 +1969,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_12segmentation_13_segmentation_4_in } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -1986,7 +1979,7 @@ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_bu return __pyx_r; } -/* "numpy.pxd":193 +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -2025,7 +2018,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":199 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -2040,7 +2033,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L3:; - /* "numpy.pxd":202 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2049,7 +2042,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":203 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2058,7 +2051,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":205 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -2067,7 +2060,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":207 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2077,7 +2070,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":208 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2089,7 +2082,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":210 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2100,7 +2093,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":212 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2110,7 +2103,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":213 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -2124,23 +2117,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "numpy.pxd":216 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2150,7 +2143,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":217 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -2164,23 +2157,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "numpy.pxd":220 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -2189,7 +2182,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":221 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -2198,7 +2191,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":222 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -2207,7 +2200,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":225 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -2216,7 +2209,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":226 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -2225,7 +2218,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":227 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -2236,7 +2229,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":228 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -2245,7 +2238,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":229 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -2258,7 +2251,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":231 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -2267,7 +2260,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":232 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -2278,7 +2271,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":233 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2287,7 +2280,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":234 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -2296,7 +2289,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":235 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -2305,7 +2298,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":238 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2314,17 +2307,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":239 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":243 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2333,7 +2328,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":245 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2349,7 +2344,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":247 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2365,7 +2360,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":250 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -2380,30 +2375,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":252 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":253 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":254 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2414,10 +2410,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":255 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -2434,24 +2430,24 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; - /* "numpy.pxd":257 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2463,7 +2459,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2476,7 +2472,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2489,7 +2485,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2502,7 +2498,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2515,7 +2511,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2528,7 +2524,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2541,7 +2537,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2554,7 +2550,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2567,7 +2563,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2580,7 +2576,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2593,7 +2589,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2606,7 +2602,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2619,7 +2615,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2632,7 +2628,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":271 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2645,7 +2641,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":272 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2658,7 +2654,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":273 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2672,33 +2668,33 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":275 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_25), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_25), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; - /* "numpy.pxd":276 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2707,7 +2703,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":277 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2720,51 +2716,51 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":279 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":280 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":281 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":284 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":285 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; @@ -2792,16 +2788,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":287 - * f[0] = 0 # Terminate format string +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): @@ -2813,7 +2809,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":288 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2823,7 +2819,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":289 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2835,7 +2831,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":290 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2845,7 +2841,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":291 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2860,7 +2856,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":767 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2877,7 +2873,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2885,7 +2881,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2903,7 +2899,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2920,7 +2916,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2928,7 +2924,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2946,7 +2942,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2963,7 +2959,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2971,7 +2967,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2989,7 +2985,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3006,7 +3002,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3014,7 +3010,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3032,7 +3028,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3049,7 +3045,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":780 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3057,7 +3053,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3075,7 +3071,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":782 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -3098,18 +3094,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":789 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3118,7 +3115,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":790 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3127,7 +3124,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":793 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -3135,31 +3132,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -3168,20 +3170,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -3189,99 +3220,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":797 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":800 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":801 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":812 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3289,16 +3319,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":813 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3307,7 +3336,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":814 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -3316,430 +3345,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":815 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":817 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":819 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":820 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":821 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":825 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":839 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":840 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":841 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":843 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_25), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_25), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":844 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3747,25 +3759,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":848 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":849 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3794,7 +3806,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":964 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3808,7 +3820,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":966 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3818,7 +3830,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":967 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3830,7 +3842,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":969 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3839,7 +3851,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":970 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3850,7 +3862,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":971 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3859,7 +3871,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":972 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3871,7 +3883,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":974 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3885,7 +3897,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":975 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3895,7 +3907,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":976 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3910,7 +3922,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":978 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3992,8 +4004,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -4157,84 +4169,84 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_22); __Pyx_INCREF(((PyObject *)__pyx_kp_u_21)); PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_u_21)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_21)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(((PyObject *)__pyx_kp_u_23)); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_u_23)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_23)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_27); __Pyx_INCREF(((PyObject *)__pyx_kp_u_26)); PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_kp_u_26)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_26)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_28 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(((PyObject *)__pyx_kp_u_23)); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_kp_u_23)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_23)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_30 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_INCREF(((PyObject *)__pyx_kp_u_29)); PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_kp_u_29)); @@ -4369,16 +4381,23 @@ PyMODINIT_FUNC PyInit__segmentation(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_segmentation"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_31), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_segmentation"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_31), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.segmentation._segmentation")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.segmentation._segmentation", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4394,11 +4413,18 @@ PyMODINIT_FUNC PyInit__segmentation(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -4488,7 +4514,7 @@ PyMODINIT_FUNC PyInit__segmentation(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":974 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4565,7 +4591,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -4579,7 +4605,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -4600,48 +4626,72 @@ static int __Pyx_ParseOptionalKeywords( while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4695,33 +4745,38 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -4754,6 +4809,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -4771,12 +4827,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -4793,9 +4873,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); @@ -4809,12 +4886,11 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } bad: + Py_XDECREF(owned_instance); return; } #endif - - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -4827,29 +4903,64 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -4921,78 +5032,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyBytes_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); - else - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); - } else { - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - #if CYTHON_PEP393_ENABLED - if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0)) - return -1; - if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_LENGTH(s1) == 1) { - Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); - Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #else - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0]; - Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0]; - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #endif - } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -5652,6 +5691,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -5704,23 +5760,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { diff --git a/nipy/algorithms/statistics/_quantile.c b/nipy/algorithms/statistics/_quantile.c index 032e6a3238..db8889c987 100644 --- a/nipy/algorithms/statistics/_quantile.c +++ b/nipy/algorithms/statistics/_quantile.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Wed Nov 14 10:59:07 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:29 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,19 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "_quantile.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":719 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +377,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +386,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +395,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +404,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +413,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +422,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +431,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +440,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +449,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +458,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -445,7 +467,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +476,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +485,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +494,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +503,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +512,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +521,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +530,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +539,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +548,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -534,7 +556,6 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -555,9 +576,10 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -566,7 +588,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -575,7 +597,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -584,7 +606,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -592,11 +614,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -609,8 +629,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -621,7 +654,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -632,16 +665,19 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ @@ -651,7 +687,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_SetItemInt_Fast(o, i, v) : \ __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) - static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -659,23 +694,40 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = PyInt_FromSsize_t(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -683,81 +735,96 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ @@ -773,7 +840,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -894,15 +960,38 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + /* Module declarations from 'cpython.buffer' */ /* Module declarations from 'cpython.ref' */ @@ -911,6 +1000,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -921,14 +1015,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'nipy.algorithms.statistics._quantile' */ #define __Pyx_MODULE_NAME "nipy.algorithms.statistics._quantile" @@ -938,6 +1025,10 @@ int __pyx_module_is_main_nipy__algorithms__statistics___quantile = 0; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_ratio, int __pyx_v_interp, int __pyx_v_axis); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_2_median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_axis); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ratio must be in range 0..1"; static char __pyx_k_3[] = "ndarray is not C contiguous"; static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; @@ -947,7 +1038,8 @@ static char __pyx_k_10[] = "Format string allocated too short, see comment in nu static char __pyx_k_13[] = "Format string allocated too short."; static char __pyx_k_15[] = "\nVery fast quantile computation using partial sorting.\nAuthor: Alexis Roche.\n"; static char __pyx_k_16[] = "0.1"; -static char __pyx_k_17[] = "nipy.algorithms.statistics._quantile"; +static char __pyx_k_19[] = "/Users/mb312/dev_trees/nipy/nipy/algorithms/statistics/_quantile.pyx"; +static char __pyx_k_20[] = "nipy.algorithms.statistics._quantile"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -955,6 +1047,7 @@ static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__X[] = "X"; +static char __pyx_k__Y[] = "Y"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; @@ -963,11 +1056,17 @@ static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; +static char __pyx_k__itX[] = "itX"; +static char __pyx_k__itY[] = "itY"; static char __pyx_k__axis[] = "axis"; +static char __pyx_k__dims[] = "dims"; +static char __pyx_k__size[] = "size"; static char __pyx_k__dtype[] = "dtype"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; @@ -976,6 +1075,7 @@ static char __pyx_k__shape[] = "shape"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__double[] = "double"; static char __pyx_k__interp[] = "interp"; +static char __pyx_k__stride[] = "stride"; static char __pyx_k___median[] = "_median"; static char __pyx_k__asarray[] = "asarray"; static char __pyx_k__strides[] = "strides"; @@ -989,7 +1089,8 @@ static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_u_10; static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_s_16; -static PyObject *__pyx_n_s_17; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_n_s_20; static PyObject *__pyx_kp_u_3; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_7; @@ -997,6 +1098,7 @@ static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s__Y; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; @@ -1004,15 +1106,22 @@ static PyObject *__pyx_n_s___median; static PyObject *__pyx_n_s___quantile; static PyObject *__pyx_n_s__asarray; static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__interp; +static PyObject *__pyx_n_s__itX; +static PyObject *__pyx_n_s__itY; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__ratio; static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__stride; static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; @@ -1024,52 +1133,30 @@ static PyObject *__pyx_k_tuple_8; static PyObject *__pyx_k_tuple_11; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_codeobj_18; +static PyObject *__pyx_k_codeobj_22; -/* "nipy/algorithms/statistics/_quantile.pyx":24 - * # This is faster than scipy.stats.scoreatpercentile owing to partial - * # sorting - * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< - * """ - * Fast quantile computation using partial sorting. This function has - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_1_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile[] = "\n Fast quantile computation using partial sorting. This function has\n similar behavior to `scipy.percentile` but runs significantly\n faster for large arrays.\n\n Parameters\n ----------\n X : array\n Input array. Will be internally converted into an array of\n doubles if needed.\n\n ratio : float\n A value in range [0, 1] defining the desired quantiles (the\n higher the ratio, the higher the quantiles).\n\n interp : boolean\n Determine whether quantiles are interpolated.\n\n axis : int\n Axis along which quantiles are computed.\n\n Output\n ------\n Y : array\n Array of quantiles\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile = {__Pyx_NAMESTR("_quantile"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_quantile = {__Pyx_NAMESTR("_quantile"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_1_quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile__quantile)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_1_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_ratio; int __pyx_v_interp; int __pyx_v_axis; - double *__pyx_v_x; - double *__pyx_v_y; - long __pyx_v_size; - long __pyx_v_stride; - PyArrayIterObject *__pyx_v_itX = 0; - PyArrayIterObject *__pyx_v_itY = 0; - PyObject *__pyx_v_dims = NULL; - PyObject *__pyx_v_Y = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - long __pyx_t_8; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__ratio,&__pyx_n_s__interp,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("_quantile"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_quantile (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__ratio,&__pyx_n_s__interp,&__pyx_n_s__axis,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -1078,14 +1165,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ratio); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ratio)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_quantile", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1101,7 +1186,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1118,6 +1203,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P if (values[2]) { __pyx_v_interp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_interp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "nipy/algorithms/statistics/_quantile.pyx":24 + * # This is faster than scipy.stats.scoreatpercentile owing to partial + * # sorting + * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< + * """ + * Fast quantile computation using partial sorting. This function has + */ __pyx_v_interp = ((int)0); } if (values[3]) { @@ -1134,6 +1227,34 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(__pyx_self, __pyx_v_X, __pyx_v_ratio, __pyx_v_interp, __pyx_v_axis); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_ratio, int __pyx_v_interp, int __pyx_v_axis) { + double *__pyx_v_x; + double *__pyx_v_y; + long __pyx_v_size; + long __pyx_v_stride; + PyArrayIterObject *__pyx_v_itX = 0; + PyArrayIterObject *__pyx_v_itY = 0; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_quantile", 0); __Pyx_INCREF(__pyx_v_X); /* "nipy/algorithms/statistics/_quantile.pyx":56 @@ -1149,14 +1270,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__double)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -1193,9 +1314,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "nipy/algorithms/statistics/_quantile.pyx":63 * @@ -1207,7 +1328,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __pyx_t_4 = PyObject_GetAttr(__pyx_v_X, __pyx_n_s__shape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; @@ -1239,7 +1360,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_dims)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dims)); __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); @@ -1403,48 +1524,33 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile__quantile(P return __pyx_r; } -/* "nipy/algorithms/statistics/_quantile.pyx":88 - * # due to the underlying algorithm that relies on - * # partial sorting as opposed to full sorting. - * def _median(X, axis=0): # <<<<<<<<<<<<<< - * """ - * Fast median computation using partial sorting. This function is - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median[] = "\n Fast median computation using partial sorting. This function is\n similar to `numpy.median` but runs significantly faster for large\n arrays.\n\n Parameters\n ----------\n X : array\n Input array. Will be internally converted into an array of\n doubles if needed.\n\n axis : int\n Axis along which medians are computed.\n\n Output\n ------\n Y : array\n Array of medians\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median = {__Pyx_NAMESTR("_median"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile_1_median)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_3_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_9_quantile_2_median[] = "\n Fast median computation using partial sorting. This function is\n similar to `numpy.median` but runs significantly faster for large\n arrays.\n\n Parameters\n ----------\n X : array\n Input array. Will be internally converted into an array of\n doubles if needed.\n\n axis : int\n Axis along which medians are computed.\n\n Output\n ------\n Y : array\n Array of medians\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_3_median = {__Pyx_NAMESTR("_median"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_3_median, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_9_quantile_2_median)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_9_quantile_3_median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_axis = 0; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("_median"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_median (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__axis,0}; PyObject* values[2] = {0,0}; values[1] = ((PyObject *)__pyx_int_0); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -1453,7 +1559,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_median") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -1474,6 +1580,30 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_9_quantile_2_median(__pyx_self, __pyx_v_X, __pyx_v_axis); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/_quantile.pyx":88 + * # due to the underlying algorithm that relies on + * # partial sorting as opposed to full sorting. + * def _median(X, axis=0): # <<<<<<<<<<<<<< + * """ + * Fast median computation using partial sorting. This function is + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_2_median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_axis) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_median", 0); /* "nipy/algorithms/statistics/_quantile.pyx":108 * Array of medians @@ -1485,7 +1615,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___quantile); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_X); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_X); __Pyx_GIVEREF(__pyx_v_X); @@ -1500,7 +1630,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py __Pyx_GOTREF(__pyx_t_4); if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__interp), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -1524,7 +1654,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py return __pyx_r; } -/* "numpy.pxd":190 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1532,8 +1673,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9_quantile_1_median(Py * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -1558,13 +1698,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -1575,11 +1715,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1588,7 +1728,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1597,16 +1737,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1616,7 +1756,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1624,11 +1764,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1637,9 +1777,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1649,37 +1789,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1689,46 +1829,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1737,7 +1877,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1746,7 +1886,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1755,7 +1895,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1764,7 +1904,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1775,49 +1915,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1826,25 +1966,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1853,17 +1993,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1872,7 +2014,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1888,7 +2030,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1900,49 +2042,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1953,10 +2096,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -1973,24 +2116,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -1999,10 +2142,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2012,10 +2155,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2025,10 +2168,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2038,10 +2181,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2051,10 +2194,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2064,10 +2207,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2077,10 +2220,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2090,10 +2233,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2103,10 +2246,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2116,10 +2259,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2129,10 +2272,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2142,10 +2285,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2155,10 +2298,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2168,10 +2311,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2181,10 +2324,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2194,10 +2337,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2207,37 +2350,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2246,7 +2389,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2255,57 +2398,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -2330,31 +2473,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2362,11 +2513,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2376,7 +2527,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2384,14 +2535,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2406,9 +2557,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2416,7 +2567,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2434,7 +2585,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2449,9 +2600,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2459,7 +2610,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2477,7 +2628,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2492,9 +2643,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2502,7 +2653,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2520,7 +2671,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2535,9 +2686,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2545,7 +2696,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2563,7 +2714,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2578,9 +2729,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2588,7 +2739,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2606,7 +2757,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2629,18 +2780,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2649,7 +2801,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2658,7 +2810,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2666,31 +2818,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2699,20 +2856,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -2720,99 +2906,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2820,16 +3005,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2838,7 +3022,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2847,430 +3031,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3278,25 +3445,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3325,7 +3492,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3337,9 +3504,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3349,7 +3516,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3361,7 +3528,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3370,7 +3537,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3381,7 +3548,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3390,7 +3557,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3402,7 +3569,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3414,9 +3581,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3426,7 +3593,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3441,7 +3608,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3483,7 +3650,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, - {&__pyx_n_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 1}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, @@ -3491,6 +3659,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, @@ -3498,22 +3667,29 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s___quantile, __pyx_k___quantile, sizeof(__pyx_k___quantile), 0, 0, 1, 1}, {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, + {&__pyx_n_s__itX, __pyx_k__itX, sizeof(__pyx_k__itX), 0, 0, 1, 1}, + {&__pyx_n_s__itY, __pyx_k__itY, sizeof(__pyx_k__itY), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__ratio, __pyx_k__ratio, sizeof(__pyx_k__ratio), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__stride, __pyx_k__stride, sizeof(__pyx_k__stride), 0, 0, 1, 1}, {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3521,7 +3697,7 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "nipy/algorithms/statistics/_quantile.pyx":60 * # Check the input ratio is in range (0,1) @@ -3531,95 +3707,161 @@ static int __Pyx_InitCachedConstants(void) { * # Allocate output array Y */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_4)); + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "numpy.pxd":819 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "nipy/algorithms/statistics/_quantile.pyx":24 + * # This is faster than scipy.stats.scoreatpercentile owing to partial + * # sorting + * def _quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< + * """ + * Fast quantile computation using partial sorting. This function has + */ + __pyx_k_tuple_17 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ratio)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 1, ((PyObject *)__pyx_n_s__ratio)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ratio)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__interp)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 2, ((PyObject *)__pyx_n_s__interp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__interp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 3, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 4, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 5, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 6, ((PyObject *)__pyx_n_s__size)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 7, ((PyObject *)__pyx_n_s__stride)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__itX)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 8, ((PyObject *)__pyx_n_s__itX)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itX)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__itY)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 9, ((PyObject *)__pyx_n_s__itY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itY)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 10, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 11, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(4, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s___quantile, 24, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/_quantile.pyx":88 + * # due to the underlying algorithm that relies on + * # partial sorting as opposed to full sorting. + * def _median(X, axis=0): # <<<<<<<<<<<<<< + * """ + * Fast median computation using partial sorting. This function is + */ + __pyx_k_tuple_21 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s___median, 88, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -3656,12 +3898,18 @@ PyMODINIT_FUNC PyInit__quantile(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__quantile(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__quantile(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3672,16 +3920,23 @@ PyMODINIT_FUNC PyInit__quantile(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_quantile"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_quantile"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.statistics._quantile")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.statistics._quantile", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3697,11 +3952,18 @@ PyMODINIT_FUNC PyInit__quantile(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -3743,7 +4005,7 @@ PyMODINIT_FUNC PyInit__quantile(void) * """ * Fast quantile computation using partial sorting. This function has */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile__quantile, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_quantile, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___quantile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3755,7 +4017,7 @@ PyMODINIT_FUNC PyInit__quantile(void) * """ * Fast median computation using partial sorting. This function is */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_1_median, NULL, __pyx_n_s_17); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_9_quantile_3_median, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___median, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3770,7 +4032,7 @@ PyMODINIT_FUNC PyInit__quantile(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3796,7 +4058,6 @@ PyMODINIT_FUNC PyInit__quantile(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -3837,7 +4098,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -3849,7 +4109,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -3863,7 +4123,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -3879,55 +4139,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -3947,9 +4229,9 @@ static int __Pyx_ParseOptionalKeywords( } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -3959,55 +4241,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -4030,7 +4317,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -4039,10 +4325,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -4052,7 +4337,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -4061,13 +4345,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -4084,14 +4391,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -4101,14 +4403,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif - - static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -4121,29 +4421,64 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -4172,12 +4507,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -4853,6 +5209,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -4862,15 +5235,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -4886,7 +5254,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -4896,7 +5264,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -4910,51 +5278,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -4965,28 +5387,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -4994,11 +5433,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5033,6 +5470,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/nipy/algorithms/statistics/histogram.c b/nipy/algorithms/statistics/histogram.c index 06c37b1643..c61ac6fe72 100644 --- a/nipy/algorithms/statistics/histogram.c +++ b/nipy/algorithms/statistics/histogram.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.16 on Fri Jul 20 15:55:44 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:30 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -11,7 +11,6 @@ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -23,22 +22,18 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - #ifndef Py_HUGE_VAL #define Py_HUGE_VAL HUGE_VAL #endif - #ifdef PYPY_VERSION #define CYTHON_COMPILING_IN_PYPY 1 #define CYTHON_COMPILING_IN_CPYTHON 0 @@ -46,28 +41,28 @@ #define CYTHON_COMPILING_IN_PYPY 0 #define CYTHON_COMPILING_IN_CPYTHON 1 #endif - -#if CYTHON_COMPILING_IN_PYPY - #define __Pyx_PyCFunction_Call PyObject_Call -#else - #define __Pyx_PyCFunction_Call PyCFunction_Call -#endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -75,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -89,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -101,11 +94,9 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) - typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ @@ -115,31 +106,30 @@ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - - -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else #define CYTHON_PEP393_ENABLED 0 - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -147,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -166,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -174,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -193,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -206,7 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -225,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -239,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -248,6 +228,7 @@ #define __Pyx_DOCSTR(n) (n) #endif + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) @@ -328,7 +309,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ @@ -379,9 +364,10 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "histogram.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":722 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -390,7 +376,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":723 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -399,7 +385,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":724 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -408,7 +394,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":725 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -417,7 +403,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":729 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -426,7 +412,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":730 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -435,7 +421,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":731 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -444,7 +430,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":732 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -453,7 +439,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":736 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -462,7 +448,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":737 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -471,7 +457,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":746 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -480,7 +466,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":747 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -489,7 +475,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":748 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -498,7 +484,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":750 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -507,7 +493,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":751 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -516,7 +502,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":752 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -525,7 +511,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":754 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -534,7 +520,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":755 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -543,7 +529,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":757 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -552,7 +538,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":758 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -561,7 +547,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":759 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -592,7 +578,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; /*--- Type declarations ---*/ -/* "numpy.pxd":761 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -601,7 +587,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":762 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -610,7 +596,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":763 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -619,7 +605,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":765 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -690,27 +676,17 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -#include +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -#if PY_MAJOR_VERSION >= 3 -#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals -#else -#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals -#endif +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -852,10 +828,10 @@ static int __Pyx_check_binary_version(void); #endif #endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ - static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + typedef struct { int code_line; PyCodeObject* code_object; @@ -884,6 +860,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -999,7 +980,6 @@ static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_9histogram_1histogram( PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("histogram (wrapper)", 0); - __pyx_self = __pyx_self; __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(__pyx_self, ((PyObject *)__pyx_v_x)); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -1022,9 +1002,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_2 = NULL; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + int __pyx_t_4; npy_uintp __pyx_t_5; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; @@ -1043,10 +1023,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyString_Equals(__pyx_t_1, ((PyObject *)__pyx_n_s__uintp), Py_EQ); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, ((PyObject *)__pyx_n_s__uintp), Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (!__pyx_t_2); - if (__pyx_t_3) { + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = (!__pyx_t_3); + if (__pyx_t_4) { /* "nipy/algorithms/statistics/histogram.pyx":27 * """ @@ -1055,10 +1037,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C * * cdef np.npy_uintp xv */ - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } @@ -1071,13 +1053,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C * cdef np.flatiter it = x.flat * cdef np.ndarray h = np.zeros(nbins, dtype='uintp') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_uintp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_4); if (unlikely((__pyx_t_5 == (npy_uintp)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_nbins = (((npy_uintp)__pyx_t_5) + 1); /* "nipy/algorithms/statistics/histogram.pyx":31 @@ -1087,11 +1069,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C * cdef np.ndarray h = np.zeros(nbins, dtype='uintp') * cdef np.npy_uintp* hv */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__flat); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_it = ((PyArrayIterObject *)__pyx_t_4); - __pyx_t_4 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__flat); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_flatiter))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_it = ((PyArrayIterObject *)__pyx_t_1); + __pyx_t_1 = 0; /* "nipy/algorithms/statistics/histogram.pyx":32 * cdef np.npy_uintp nbins = x.max() + 1 @@ -1100,26 +1082,26 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C * cdef np.npy_uintp* hv * */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nbins); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_nbins); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__uintp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__uintp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_h = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; @@ -1132,8 +1114,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C * hv = np.PyArray_DATA(h) + xv */ while (1) { - __pyx_t_3 = PyArray_ITER_NOTDONE(__pyx_v_it); - if (!__pyx_t_3) break; + __pyx_t_4 = PyArray_ITER_NOTDONE(__pyx_v_it); + if (!__pyx_t_4) break; /* "nipy/algorithms/statistics/histogram.pyx":36 * @@ -1187,7 +1169,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_AddTraceback("nipy.algorithms.statistics.histogram.histogram", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -1201,8 +1183,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_9histogram_histogram(C } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -1211,7 +1193,7 @@ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_bu return __pyx_r; } -/* "numpy.pxd":193 +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1250,7 +1232,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":199 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -1265,7 +1247,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L3:; - /* "numpy.pxd":202 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1274,7 +1256,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":203 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1283,7 +1265,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":205 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1292,7 +1274,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":207 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1302,7 +1284,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":208 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1314,7 +1296,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":210 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1325,7 +1307,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":212 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1335,7 +1317,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":213 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1349,23 +1331,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "numpy.pxd":216 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1375,7 +1357,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":217 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1389,23 +1371,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "numpy.pxd":220 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1414,7 +1396,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":221 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1423,7 +1405,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":222 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1432,7 +1414,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":225 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1441,7 +1423,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":226 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1450,7 +1432,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":227 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1461,7 +1443,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":228 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1470,7 +1452,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":229 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1483,7 +1465,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":231 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1492,7 +1474,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":232 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1503,7 +1485,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":233 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1512,7 +1494,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":234 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1521,7 +1503,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":235 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1530,7 +1512,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":238 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1539,17 +1521,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":239 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":243 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1558,7 +1542,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":245 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1574,7 +1558,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":247 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1590,7 +1574,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":250 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1605,30 +1589,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":252 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":253 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":254 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1639,10 +1624,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":255 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -1659,24 +1644,24 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; - /* "numpy.pxd":257 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -1688,7 +1673,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1701,7 +1686,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1714,7 +1699,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1727,7 +1712,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1740,7 +1725,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1753,7 +1738,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1766,7 +1751,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1779,7 +1764,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1792,7 +1777,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1805,7 +1790,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1818,7 +1803,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1831,7 +1816,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1844,7 +1829,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1857,7 +1842,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":271 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1870,7 +1855,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":272 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -1883,7 +1868,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":273 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -1897,33 +1882,33 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":275 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; - /* "numpy.pxd":276 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -1932,7 +1917,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":277 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -1945,51 +1930,51 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":279 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":280 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":281 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":284 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":285 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; @@ -2017,16 +2002,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":287 - * f[0] = 0 # Terminate format string +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): @@ -2038,7 +2023,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":288 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2048,7 +2033,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":289 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2060,7 +2045,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":290 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2070,7 +2055,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":291 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2085,7 +2070,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":767 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2102,7 +2087,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2110,7 +2095,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2128,7 +2113,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2145,7 +2130,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2153,7 +2138,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2171,7 +2156,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2188,7 +2173,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2196,7 +2181,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2214,7 +2199,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2231,7 +2216,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2239,7 +2224,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2257,7 +2242,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2274,7 +2259,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":780 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2282,7 +2267,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2300,7 +2285,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":782 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2323,18 +2308,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":789 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2343,7 +2329,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":790 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2352,7 +2338,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":793 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2360,31 +2346,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2393,20 +2384,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -2414,99 +2434,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":797 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":800 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":801 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":812 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2514,16 +2533,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":813 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2532,7 +2550,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":814 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2541,430 +2559,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":815 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":817 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":819 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":820 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":821 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":825 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":839 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":840 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":841 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":843 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":844 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -2972,25 +2973,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":848 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":849 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3019,7 +3020,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":964 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3033,7 +3034,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":966 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3043,7 +3044,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":967 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3055,7 +3056,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":969 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3064,7 +3065,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":970 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3075,7 +3076,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":971 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3084,7 +3085,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":972 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3096,7 +3097,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":974 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3110,7 +3111,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":975 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3120,7 +3121,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":976 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3135,7 +3136,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":978 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3205,8 +3206,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3230,84 +3231,84 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_8); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); @@ -3399,16 +3400,23 @@ PyMODINIT_FUNC PyInit_histogram(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("histogram"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("histogram"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.statistics.histogram")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.statistics.histogram", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3424,11 +3432,18 @@ PyMODINIT_FUNC PyInit_histogram(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -3476,7 +3491,7 @@ PyMODINIT_FUNC PyInit_histogram(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":974 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3568,33 +3583,38 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -3627,6 +3647,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -3644,12 +3665,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -3666,9 +3711,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); @@ -3682,6 +3724,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } bad: + Py_XDECREF(owned_instance); return; } #endif @@ -3698,29 +3741,64 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { @@ -3792,78 +3870,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) { - if (PyBytes_GET_SIZE(s1) != PyBytes_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyBytes_GET_SIZE(s1) == 1) { - if (equals == Py_EQ) - return (PyBytes_AS_STRING(s1)[0] == PyBytes_AS_STRING(s2)[0]); - else - return (PyBytes_AS_STRING(s1)[0] != PyBytes_AS_STRING(s2)[0]); - } else { - int result = memcmp(PyBytes_AS_STRING(s1), PyBytes_AS_STRING(s2), (size_t)PyBytes_GET_SIZE(s1)); - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) { - if (s1 == s2) { - return (equals == Py_EQ); - } else if (PyUnicode_CheckExact(s1) & PyUnicode_CheckExact(s2)) { - #if CYTHON_PEP393_ENABLED - if ((PyUnicode_READY(s1) < 0) || (PyUnicode_READY(s2) < 0)) - return -1; - if (PyUnicode_GET_LENGTH(s1) != PyUnicode_GET_LENGTH(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_LENGTH(s1) == 1) { - Py_UCS4 ch1 = PyUnicode_READ_CHAR(s1, 0); - Py_UCS4 ch2 = PyUnicode_READ_CHAR(s2, 0); - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #else - if (PyUnicode_GET_SIZE(s1) != PyUnicode_GET_SIZE(s2)) { - return (equals == Py_NE); - } else if (PyUnicode_GET_SIZE(s1) == 1) { - Py_UNICODE ch1 = PyUnicode_AS_UNICODE(s1)[0]; - Py_UNICODE ch2 = PyUnicode_AS_UNICODE(s2)[0]; - return (equals == Py_EQ) ? (ch1 == ch2) : (ch1 != ch2); - #endif - } else { - int result = PyUnicode_Compare(s1, s2); - if ((result == -1) && unlikely(PyErr_Occurred())) - return -1; - return (equals == Py_EQ) ? (result == 0) : (result != 0); - } - } else if ((s1 == Py_None) & PyUnicode_CheckExact(s2)) { - return (equals == Py_NE); - } else if ((s2 == Py_None) & PyUnicode_CheckExact(s1)) { - return (equals == Py_NE); - } else { - int result; - PyObject* py_result = PyObject_RichCompare(s1, s2, equals); - if (!py_result) - return -1; - result = __Pyx_PyObject_IsTrue(py_result); - Py_DECREF(py_result); - return result; - } -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -4523,6 +4529,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -4575,23 +4598,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { diff --git a/nipy/algorithms/statistics/intvol.c b/nipy/algorithms/statistics/intvol.c index 199497a4e3..e2384eeb98 100644 --- a/nipy/algorithms/statistics/intvol.c +++ b/nipy/algorithms/statistics/intvol.c @@ -1,16 +1,16 @@ -/* Generated by Cython 0.15.1 on Thu Jul 26 22:50:13 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:31 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - #include /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -22,36 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -59,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -73,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,24 +92,44 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -108,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -127,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -135,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -154,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -167,16 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - - -#if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) -#endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -195,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -209,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -218,6 +228,15 @@ #define __Pyx_DOCSTR(n) (n) #endif + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" @@ -267,7 +286,7 @@ # else # define CYTHON_UNUSED # endif -# elif defined(__ICC) || defined(__INTEL_COMPILER) +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED @@ -291,8 +310,12 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ @@ -317,7 +340,6 @@ static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) #define CYTHON_CCOMPLEX 1 @@ -327,7 +349,6 @@ static const char *__pyx_filename; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -335,18 +356,54 @@ static const char *__pyx_filename; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + static const char *__pyx_f[] = { "intvol.pyx", "numpy.pxd", + "type.pxd", }; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; -/* "numpy.pxd":719 + +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -355,7 +412,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":720 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -364,7 +421,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":721 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -373,7 +430,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":722 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -382,7 +439,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":726 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -391,7 +448,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":727 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -400,7 +457,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":728 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -409,7 +466,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":729 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -418,7 +475,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":733 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -427,7 +484,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":734 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -436,7 +493,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":743 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -445,7 +502,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":744 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -454,7 +511,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":745 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -463,7 +520,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":747 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -472,7 +529,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":748 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -481,7 +538,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":749 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -490,7 +547,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":751 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -499,7 +556,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":752 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -508,7 +565,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":754 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -517,7 +574,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":755 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -526,7 +583,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":756 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -534,7 +591,6 @@ typedef npy_double __pyx_t_5numpy_double_t; * ctypedef npy_cfloat cfloat_t */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -555,9 +611,10 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif + /*--- Type declarations ---*/ -/* "numpy.pxd":758 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -566,7 +623,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":759 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -575,7 +632,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":760 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -584,7 +641,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":762 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -592,12 +649,9 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -610,8 +664,21 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; - #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) @@ -622,7 +689,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) @@ -633,16 +700,52 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +#if PY_VERSION_HEX < 0x02050000 +#ifndef PyAnySet_CheckExact +#define PyAnySet_CheckExact(ob) \ + ((ob)->ob_type == &PySet_Type || \ + (ob)->ob_type == &PyFrozenSet_Type) +#define PySet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) +#define Pyx_PyFrozenSet_New(iterable) \ + PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) +#define PySet_Size(anyset) \ + PyObject_Size((anyset)) +#define PySet_Contains(anyset, key) \ + PySequence_Contains((anyset), (key)) +#define PySet_Pop(set) \ + PyObject_CallMethod(set, (char *)"pop", NULL) +static CYTHON_INLINE int PySet_Clear(PyObject *set) { + PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} +static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} +static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { + PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); + if (!ret) return -1; + Py_DECREF(ret); return 0; +} +#endif /* PyAnySet_CheckExact (<= Py2.4) */ +#endif /* < Py2.5 */ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ @@ -651,34 +754,12 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; - -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; - - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -686,76 +767,104 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j Py_DECREF(j); return r; } - - #define __Pyx_GetItemInt_List(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } - - #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { - PyObject *r; - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { - r = PySequence_GetItem(o, i); + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if (likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { /* inlined PySequence_GetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } + return m->sq_item(o, i); + } } - else { - r = __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); } - return r; +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } + static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ + #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif static CYTHON_INLINE int __Pyx_mod_int(int, int); /* proto */ @@ -764,113 +873,44 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed static CYTHON_INLINE long __Pyx_mod_long(long, long); /* proto */ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release -#endif - -Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ - -#if PY_VERSION_HEX < 0x02050000 -#ifndef PyAnySet_CheckExact - -#define PyAnySet_CheckExact(ob) \ - ((ob)->ob_type == &PySet_Type || \ - (ob)->ob_type == &PyFrozenSet_Type) - -#define PySet_New(iterable) \ - PyObject_CallFunctionObjArgs((PyObject *)&PySet_Type, (iterable), NULL) - -#define Pyx_PyFrozenSet_New(iterable) \ - PyObject_CallFunctionObjArgs((PyObject *)&PyFrozenSet_Type, (iterable), NULL) - -#define PySet_Size(anyset) \ - PyObject_Size((anyset)) - -#define PySet_Contains(anyset, key) \ - PySequence_Contains((anyset), (key)) - -#define PySet_Pop(set) \ - PyObject_CallMethod(set, (char *)"pop", NULL) - -static CYTHON_INLINE int PySet_Clear(PyObject *set) { - PyObject *ret = PyObject_CallMethod(set, (char *)"clear", NULL); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -static CYTHON_INLINE int PySet_Discard(PyObject *set, PyObject *key) { - PyObject *ret = PyObject_CallMethod(set, (char *)"discard", (char *)"O", key); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -static CYTHON_INLINE int PySet_Add(PyObject *set, PyObject *key) { - PyObject *ret = PyObject_CallMethod(set, (char *)"add", (char *)"O", key); - if (!ret) return -1; - Py_DECREF(ret); return 0; -} - -#endif /* PyAnySet_CheckExact (<= Py2.4) */ - -#if PY_VERSION_HEX < 0x02040000 -#ifndef Py_SETOBJECT_H -#define Py_SETOBJECT_H - -static PyTypeObject *__Pyx_PySet_Type = NULL; -static PyTypeObject *__Pyx_PyFrozenSet_Type = NULL; +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -#define PySet_Type (*__Pyx_PySet_Type) -#define PyFrozenSet_Type (*__Pyx_PyFrozenSet_Type) +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -#define PyAnySet_Check(ob) \ - (PyAnySet_CheckExact(ob) || \ - PyType_IsSubtype((ob)->ob_type, &PySet_Type) || \ - PyType_IsSubtype((ob)->ob_type, &PyFrozenSet_Type)) +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -#define PyFrozenSet_CheckExact(ob) ((ob)->ob_type == &PyFrozenSet_Type) +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static int __Pyx_Py23SetsImport(void) { - PyObject *sets=0, *Set=0, *ImmutableSet=0; +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; - sets = PyImport_ImportModule((char *)"sets"); - if (!sets) goto bad; - Set = PyObject_GetAttrString(sets, (char *)"Set"); - if (!Set) goto bad; - ImmutableSet = PyObject_GetAttrString(sets, (char *)"ImmutableSet"); - if (!ImmutableSet) goto bad; - Py_DECREF(sets); +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif - __Pyx_PySet_Type = (PyTypeObject*) Set; - __Pyx_PyFrozenSet_Type = (PyTypeObject*) ImmutableSet; - return 0; +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; - bad: - Py_XDECREF(sets); - Py_XDECREF(Set); - Py_XDECREF(ImmutableSet); - return -1; -} +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -#else -static int __Pyx_Py23SetsImport(void) { return 0; } -#endif /* !Py_SETOBJECT_H */ -#endif /* < Py2.4 */ -#endif /* < Py2.5 */ +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name); static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject *); @@ -888,7 +928,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -1009,16 +1048,37 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from 'cython.cython.view' */ /* Module declarations from 'cython' */ @@ -1030,6 +1090,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1040,14 +1105,7 @@ static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from 'nipy.algorithms.statistics.intvol' */ static double __pyx_v_4nipy_10algorithms_10statistics_6intvol_PI; @@ -1059,8 +1117,8 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol__mu1_tetface(doubl static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri(double, double, double, double, double, double, int __pyx_skip_dispatch); /*proto*/ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri(double, double, double, double, double, double, int __pyx_skip_dispatch); /*proto*/ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge(double, double, double, int __pyx_skip_dispatch); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t = { "intp_t", NULL, sizeof(__pyx_t_5numpy_intp_t), 'I' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t = { "intp_t", NULL, sizeof(__pyx_t_5numpy_intp_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_intp_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_intp_t), 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), { 0 }, 0, 'R', 0, 0 }; #define __Pyx_MODULE_NAME "nipy.algorithms.statistics.intvol" int __pyx_module_is_main_nipy__algorithms__statistics__intvol = 0; @@ -1069,6 +1127,24 @@ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_sorted; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu2_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu1_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6_mu1_tetface(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_Ds0s0, double __pyx_v_Ds0s1, double __pyx_v_Ds1s1, double __pyx_v_Ds0t0, double __pyx_v_Ds0t1, double __pyx_v_Ds1t0, double __pyx_v_Ds1t1, double __pyx_v_Dt0t0, double __pyx_v_Dt0t1, double __pyx_v_Dt1t1); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8mu2_tri(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10mu1_tri(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12mu1_edge(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D11); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14EC3d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_16Lips3d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coords, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_18_convert_stride3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_20_convert_stride2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_22_convert_stride1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_24Lips2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coords, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_26EC2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_28Lips1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coords, PyArrayObject *__pyx_v_mask); /* proto */ +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_30EC1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "mask should be filled with 0/1 values, but be of type np.int"; static char __pyx_k_8[] = "cube_with_strides_center"; static char __pyx_k_17[] = "shape of mask does not match coordinates"; @@ -1081,27 +1157,60 @@ static char __pyx_k_83[] = "Format string allocated too short."; static char __pyx_k_85[] = "\nThe estimators for the intrinsic volumes appearing in this module\nwere partially supported by NSF grant DMS-0405970.\n\nTaylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n\n"; static char __pyx_k_86[] = "scipy.sparse"; static char __pyx_k_87[] = "nipy.utils.arrays"; -static char __pyx_k_88[] = "nipy.algorithms.statistics.intvol"; +static char __pyx_k_90[] = "/Users/mb312/dev_trees/nipy/nipy/algorithms/statistics/intvol.pyx"; +static char __pyx_k_91[] = "nipy.algorithms.statistics.intvol"; static char __pyx_k__B[] = "B"; +static char __pyx_k__D[] = "D"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; +static char __pyx_k__j[] = "j"; +static char __pyx_k__k[] = "k"; static char __pyx_k__l[] = "l"; +static char __pyx_k__m[] = "m"; static char __pyx_k__q[] = "q"; +static char __pyx_k__r[] = "r"; +static char __pyx_k__s[] = "s"; static char __pyx_k__v[] = "v"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__d2[] = "d2"; +static char __pyx_k__d3[] = "d3"; +static char __pyx_k__d4[] = "d4"; +static char __pyx_k__l0[] = "l0"; +static char __pyx_k__l1[] = "l1"; +static char __pyx_k__l2[] = "l2"; +static char __pyx_k__l3[] = "l3"; +static char __pyx_k__m2[] = "m2"; +static char __pyx_k__m3[] = "m3"; +static char __pyx_k__m4[] = "m4"; +static char __pyx_k__mr[] = "mr"; +static char __pyx_k__ms[] = "ms"; static char __pyx_k__np[] = "np"; static char __pyx_k__pi[] = "pi"; +static char __pyx_k__rr[] = "rr"; +static char __pyx_k__s0[] = "s0"; +static char __pyx_k__s1[] = "s1"; +static char __pyx_k__s2[] = "s2"; +static char __pyx_k__ss[] = "ss"; +static char __pyx_k__v0[] = "v0"; +static char __pyx_k__v1[] = "v1"; +static char __pyx_k__v2[] = "v2"; +static char __pyx_k__v3[] = "v3"; +static char __pyx_k__w0[] = "w0"; +static char __pyx_k__w1[] = "w1"; +static char __pyx_k__w2[] = "w2"; +static char __pyx_k__w3[] = "w3"; static char __pyx_k__D00[] = "D00"; static char __pyx_k__D01[] = "D01"; static char __pyx_k__D02[] = "D02"; @@ -1112,7 +1221,14 @@ static char __pyx_k__D13[] = "D13"; static char __pyx_k__D22[] = "D22"; static char __pyx_k__D23[] = "D23"; static char __pyx_k__D33[] = "D33"; +static char __pyx_k__ds2[] = "ds2"; +static char __pyx_k__ds3[] = "ds3"; +static char __pyx_k__ds4[] = "ds4"; static char __pyx_k__int[] = "int"; +static char __pyx_k__res[] = "res"; +static char __pyx_k__ss0[] = "ss0"; +static char __pyx_k__ss1[] = "ss1"; +static char __pyx_k__ss2[] = "ss2"; static char __pyx_k__sum[] = "sum"; static char __pyx_k__EC1d[] = "EC1d"; static char __pyx_k__EC2d[] = "EC2d"; @@ -1121,7 +1237,12 @@ static char __pyx_k__bool[] = "bool"; static char __pyx_k__intp[] = "intp"; static char __pyx_k__mask[] = "mask"; static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__npix[] = "npix"; +static char __pyx_k__nvox[] = "nvox"; static char __pyx_k__size[] = "size"; +static char __pyx_k__ss0d[] = "ss0d"; +static char __pyx_k__ss1d[] = "ss1d"; +static char __pyx_k__ss2d[] = "ss2d"; static char __pyx_k__Ds0s0[] = "Ds0s0"; static char __pyx_k__Ds0s1[] = "Ds0s1"; static char __pyx_k__Ds0t0[] = "Ds0t0"; @@ -1134,28 +1255,43 @@ static char __pyx_k__Dt0t1[] = "Dt0t1"; static char __pyx_k__Dt1t1[] = "Dt1t1"; static char __pyx_k__array[] = "array"; static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__fmask[] = "fmask"; +static char __pyx_k__index[] = "index"; static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__pmask[] = "pmask"; static char __pyx_k__range[] = "range"; static char __pyx_k__shape[] = "shape"; +static char __pyx_k__union[] = "union"; static char __pyx_k__utils[] = "utils"; +static char __pyx_k__value[] = "value"; +static char __pyx_k__verts[] = "verts"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__Lips1d[] = "Lips1d"; static char __pyx_k__Lips2d[] = "Lips2d"; static char __pyx_k__Lips3d[] = "Lips3d"; static char __pyx_k__coords[] = "coords"; +static char __pyx_k__fpmask[] = "fpmask"; static char __pyx_k__hstack[] = "hstack"; +static char __pyx_k__mask_c[] = "mask_c"; +static char __pyx_k__pindex[] = "pindex"; static char __pyx_k__sorted[] = "sorted"; static char __pyx_k__unique[] = "unique"; +static char __pyx_k__fcoords[] = "fcoords"; static char __pyx_k__reshape[] = "reshape"; static char __pyx_k__squeeze[] = "squeeze"; static char __pyx_k__stride1[] = "stride1"; static char __pyx_k__stride2[] = "stride2"; +static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__coords_c[] = "coords_c"; +static char __pyx_k__dstrides[] = "dstrides"; static char __pyx_k__issubset[] = "issubset"; +static char __pyx_k__cvertices[] = "cvertices"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__difference[] = "difference"; static char __pyx_k__dok_matrix[] = "dok_matrix"; +static char __pyx_k__pmask_shape[] = "pmask_shape"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__strides_from[] = "strides_from"; static char __pyx_k__join_complexes[] = "join_complexes"; @@ -1173,7 +1309,9 @@ static PyObject *__pyx_kp_u_80; static PyObject *__pyx_kp_u_83; static PyObject *__pyx_n_s_86; static PyObject *__pyx_n_s_87; -static PyObject *__pyx_n_s_88; +static PyObject *__pyx_kp_s_90; +static PyObject *__pyx_n_s_91; +static PyObject *__pyx_n_s__D; static PyObject *__pyx_n_s__D00; static PyObject *__pyx_n_s__D01; static PyObject *__pyx_n_s__D02; @@ -1209,33 +1347,93 @@ static PyObject *__pyx_n_s___convert_stride2; static PyObject *__pyx_n_s___convert_stride3; static PyObject *__pyx_n_s__array; static PyObject *__pyx_n_s__bool; +static PyObject *__pyx_n_s__c; static PyObject *__pyx_n_s__coords; +static PyObject *__pyx_n_s__coords_c; +static PyObject *__pyx_n_s__cvertices; +static PyObject *__pyx_n_s__d2; +static PyObject *__pyx_n_s__d3; +static PyObject *__pyx_n_s__d4; static PyObject *__pyx_n_s__difference; static PyObject *__pyx_n_s__dok_matrix; +static PyObject *__pyx_n_s__ds2; +static PyObject *__pyx_n_s__ds3; +static PyObject *__pyx_n_s__ds4; +static PyObject *__pyx_n_s__dstrides; static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__fcoords; +static PyObject *__pyx_n_s__fmask; +static PyObject *__pyx_n_s__fpmask; static PyObject *__pyx_n_s__hstack; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__index; static PyObject *__pyx_n_s__int; static PyObject *__pyx_n_s__intp; static PyObject *__pyx_n_s__issubset; +static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__join_complexes; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__l; +static PyObject *__pyx_n_s__l0; +static PyObject *__pyx_n_s__l1; +static PyObject *__pyx_n_s__l2; +static PyObject *__pyx_n_s__l3; +static PyObject *__pyx_n_s__m; +static PyObject *__pyx_n_s__m2; +static PyObject *__pyx_n_s__m3; +static PyObject *__pyx_n_s__m4; static PyObject *__pyx_n_s__mask; +static PyObject *__pyx_n_s__mask_c; +static PyObject *__pyx_n_s__mr; +static PyObject *__pyx_n_s__ms; static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__npix; static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__nvox; static PyObject *__pyx_n_s__pi; +static PyObject *__pyx_n_s__pindex; +static PyObject *__pyx_n_s__pmask; +static PyObject *__pyx_n_s__pmask_shape; +static PyObject *__pyx_n_s__r; static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__res; static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__rr; +static PyObject *__pyx_n_s__s; +static PyObject *__pyx_n_s__s0; +static PyObject *__pyx_n_s__s1; +static PyObject *__pyx_n_s__s2; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__sorted; static PyObject *__pyx_n_s__squeeze; +static PyObject *__pyx_n_s__ss; +static PyObject *__pyx_n_s__ss0; +static PyObject *__pyx_n_s__ss0d; +static PyObject *__pyx_n_s__ss1; +static PyObject *__pyx_n_s__ss1d; +static PyObject *__pyx_n_s__ss2; +static PyObject *__pyx_n_s__ss2d; static PyObject *__pyx_n_s__stride1; static PyObject *__pyx_n_s__stride2; +static PyObject *__pyx_n_s__strides; static PyObject *__pyx_n_s__strides_from; static PyObject *__pyx_n_s__sum; +static PyObject *__pyx_n_s__union; static PyObject *__pyx_n_s__unique; static PyObject *__pyx_n_s__utils; static PyObject *__pyx_n_s__v; +static PyObject *__pyx_n_s__v0; +static PyObject *__pyx_n_s__v1; +static PyObject *__pyx_n_s__v2; +static PyObject *__pyx_n_s__v3; +static PyObject *__pyx_n_s__value; +static PyObject *__pyx_n_s__verts; +static PyObject *__pyx_n_s__w0; +static PyObject *__pyx_n_s__w1; +static PyObject *__pyx_n_s__w2; +static PyObject *__pyx_n_s__w3; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; @@ -1320,6 +1518,24 @@ static PyObject *__pyx_k_tuple_78; static PyObject *__pyx_k_tuple_81; static PyObject *__pyx_k_tuple_82; static PyObject *__pyx_k_tuple_84; +static PyObject *__pyx_k_tuple_88; +static PyObject *__pyx_k_tuple_92; +static PyObject *__pyx_k_tuple_94; +static PyObject *__pyx_k_tuple_96; +static PyObject *__pyx_k_tuple_98; +static PyObject *__pyx_k_tuple_100; +static PyObject *__pyx_k_tuple_102; +static PyObject *__pyx_k_tuple_104; +static PyObject *__pyx_k_tuple_106; +static PyObject *__pyx_k_codeobj_89; +static PyObject *__pyx_k_codeobj_93; +static PyObject *__pyx_k_codeobj_95; +static PyObject *__pyx_k_codeobj_97; +static PyObject *__pyx_k_codeobj_99; +static PyObject *__pyx_k_codeobj_101; +static PyObject *__pyx_k_codeobj_103; +static PyObject *__pyx_k_codeobj_105; +static PyObject *__pyx_k_codeobj_107; /* "nipy/algorithms/statistics/intvol.pyx":36 * @@ -1329,8 +1545,8 @@ static PyObject *__pyx_k_tuple_84; * double D22, double D23, */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_1mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_C00; double __pyx_v_C01; double __pyx_v_C02; @@ -1442,17 +1658,10 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet(double __p return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":36 - * - * - * cpdef double mu3_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< - * double D11, double D12, double D13, - * double D22, double D23, - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_1mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_mu3_tet[] = " Compute the 3rd intrinsic volume of a tetrahedron.\n\n 3rd intrinsic volume (just volume in this case) of a tetrahedron with\n coordinates implied by dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D03 : float\n ``cv0.dot(cv3)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D13 : float\n ``cv1.dot(cv3)``\n D22 : float\n ``cv2.dot(cv2)``\n D23 : float\n ``cv2.dot(cv2)``\n D33 : float\n ``cv3.dot(cv3)``\n\n Returns\n -------\n mu3 : float\n volume of tetrahedron\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_1mu3_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D02; @@ -1463,20 +1672,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObje double __pyx_v_D22; double __pyx_v_D23; double __pyx_v_D33; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; - __Pyx_RefNannySetupContext("mu3_tet"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu3_tet (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); @@ -1491,68 +1696,58 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObje default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23); - if (likely(values[8])) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33); - if (likely(values[9])) kw_args--; + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu3_tet", 1, 10, 10, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu3_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu3_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; @@ -1587,6 +1782,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObje __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":36 + * + * + * cpdef double mu3_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< + * double D11, double D12, double D13, + * double D22, double D23, + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu3_tet", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet(__pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -1614,8 +1830,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet(PyObje * double D22, double D23, */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_3mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_mu; double __pyx_r; @@ -1679,17 +1895,10 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet(double __p return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":91 - * - * - * cpdef double mu2_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< - * double D11, double D12, double D13, - * double D22, double D23, - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_1mu2_tet[] = " Compute the 2nd intrinsic volume of tetrahedron\n\n 2nd intrinsic volume (half the surface area) of a tetrahedron with coordinates\n implied by dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D03 : float\n ``cv0.dot(cv3)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D13 : float\n ``cv1.dot(cv3)``\n D22 : float\n ``cv2.dot(cv2)``\n D23 : float\n ``cv2.dot(cv2)``\n D33 : float\n ``cv3.dot(cv3)``\n\n Returns\n -------\n mu2 : float\n Half tetrahedron surface area\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_3mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_2mu2_tet[] = " Compute the 2nd intrinsic volume of tetrahedron\n\n 2nd intrinsic volume (half the surface area) of a tetrahedron with coordinates\n implied by dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D03 : float\n ``cv0.dot(cv3)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D13 : float\n ``cv1.dot(cv3)``\n D22 : float\n ``cv2.dot(cv2)``\n D23 : float\n ``cv2.dot(cv2)``\n D33 : float\n ``cv3.dot(cv3)``\n\n Returns\n -------\n mu2 : float\n Half tetrahedron surface area\n "; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_3mu2_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D02; @@ -1700,20 +1909,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObj double __pyx_v_D22; double __pyx_v_D23; double __pyx_v_D33; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; - __Pyx_RefNannySetupContext("mu2_tet"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu2_tet (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); @@ -1728,68 +1933,58 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23); - if (likely(values[8])) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33); - if (likely(values[9])) kw_args--; + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tet", 1, 10, 10, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu2_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu2_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; @@ -1824,6 +2019,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu2_tet(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":91 + * + * + * cpdef double mu2_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< + * double D11, double D12, double D13, + * double D22, double D23, + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu2_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu2_tet", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet(__pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -1851,8 +2067,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet(PyObj * double D22, double D23, */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_5mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_mu; double __pyx_r; @@ -1934,17 +2150,10 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet(double __p return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":138 - * - * - * cpdef double mu1_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< - * double D11, double D12, double D13, - * double D22, double D23, - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_2mu1_tet[] = " Return 3rd intrinsic volume of tetrahedron\n\n Compute the 3rd intrinsic volume (sum of external angles * edge\n lengths) of a tetrahedron for which the input arguments represent the\n coordinate dot products of the vertices.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D03 : float\n ``cv0.dot(cv3)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D13 : float\n ``cv1.dot(cv3)``\n D22 : float\n ``cv2.dot(cv2)``\n D23 : float\n ``cv2.dot(cv2)``\n D33 : float\n ``cv3.dot(cv3)``\n\n Returns\n -------\n mu1 : float\n 3rd intrinsic volume of tetrahedron\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_5mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_4mu1_tet[] = " Return 3rd intrinsic volume of tetrahedron\n\n Compute the 3rd intrinsic volume (sum of external angles * edge\n lengths) of a tetrahedron for which the input arguments represent the\n coordinate dot products of the vertices.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D03 : float\n ``cv0.dot(cv3)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D13 : float\n ``cv1.dot(cv3)``\n D22 : float\n ``cv2.dot(cv2)``\n D23 : float\n ``cv2.dot(cv2)``\n D33 : float\n ``cv3.dot(cv3)``\n\n Returns\n -------\n mu1 : float\n 3rd intrinsic volume of tetrahedron\n "; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_5mu1_tet(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D02; @@ -1955,20 +2164,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObj double __pyx_v_D22; double __pyx_v_D23; double __pyx_v_D33; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; - __Pyx_RefNannySetupContext("mu1_tet"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu1_tet (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D03,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D13,&__pyx_n_s__D22,&__pyx_n_s__D23,&__pyx_n_s__D33,0}; PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); @@ -1983,68 +2188,58 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D03)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D13)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23); - if (likely(values[8])) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D23)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33); - if (likely(values[9])) kw_args--; + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D33)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tet", 1, 10, 10, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu1_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu1_tet") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; @@ -2079,6 +2274,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu1_tet(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":138 + * + * + * cpdef double mu1_tet(double D00, double D01, double D02, double D03, # <<<<<<<<<<<<<< + * double D11, double D12, double D13, + * double D22, double D23, + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu1_tet(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D03, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D13, double __pyx_v_D22, double __pyx_v_D23, double __pyx_v_D33) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu1_tet", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet(__pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D03, __pyx_v_D11, __pyx_v_D12, __pyx_v_D13, __pyx_v_D22, __pyx_v_D23, __pyx_v_D33, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2178,8 +2394,8 @@ static CYTHON_INLINE double __pyx_f_4nipy_10algorithms_10statistics_6intvol_limi * double Ds1s1, */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol__mu1_tetface(double __pyx_v_Ds0s0, double __pyx_v_Ds0s1, double __pyx_v_Ds1s1, double __pyx_v_Ds0t0, double __pyx_v_Ds0t1, double __pyx_v_Ds1t0, double __pyx_v_Ds1t1, double __pyx_v_Dt0t0, double __pyx_v_Dt0t1, double __pyx_v_Dt1t1, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_7_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol__mu1_tetface(double __pyx_v_Ds0s0, double __pyx_v_Ds0s1, double __pyx_v_Ds1s1, double __pyx_v_Ds0t0, double __pyx_v_Ds0t1, double __pyx_v_Ds1t0, double __pyx_v_Ds1t1, double __pyx_v_Dt0t0, double __pyx_v_Dt0t1, double __pyx_v_Dt1t1, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_A00; double __pyx_v_A01; double __pyx_v_A02; @@ -2374,16 +2590,9 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol__mu1_tetface(doubl return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":202 - * - * @cython.cdivision(True) - * cpdef double _mu1_tetface(double Ds0s0, # <<<<<<<<<<<<<< - * double Ds0s1, - * double Ds1s1, - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_7_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_7_mu1_tetface(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_Ds0s0; double __pyx_v_Ds0s1; double __pyx_v_Ds1s1; @@ -2394,20 +2603,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface( double __pyx_v_Dt0t0; double __pyx_v_Dt0t1; double __pyx_v_Dt1t1; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Ds0s0,&__pyx_n_s__Ds0s1,&__pyx_n_s__Ds1s1,&__pyx_n_s__Ds0t0,&__pyx_n_s__Ds0t1,&__pyx_n_s__Ds1t0,&__pyx_n_s__Ds1t1,&__pyx_n_s__Dt0t0,&__pyx_n_s__Dt0t1,&__pyx_n_s__Dt1t1,0}; - __Pyx_RefNannySetupContext("_mu1_tetface"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_mu1_tetface (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Ds0s0,&__pyx_n_s__Ds0s1,&__pyx_n_s__Ds1s1,&__pyx_n_s__Ds0t0,&__pyx_n_s__Ds0t1,&__pyx_n_s__Ds1t0,&__pyx_n_s__Ds1t1,&__pyx_n_s__Dt0t0,&__pyx_n_s__Dt0t1,&__pyx_n_s__Dt1t1,0}; PyObject* values[10] = {0,0,0,0,0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); @@ -2422,68 +2627,58 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface( default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0s0); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0s0)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0s1); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0s1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1s1); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1s1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0t0); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0t0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0t1); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds0t1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1t0); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1t0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1t1); - if (likely(values[6])) kw_args--; + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Ds1t1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: - values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt0t0); - if (likely(values[7])) kw_args--; + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt0t0)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: - values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt0t1); - if (likely(values[8])) kw_args--; + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt0t1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: - values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt1t1); - if (likely(values[9])) kw_args--; + if (likely((values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Dt1t1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_mu1_tetface", 1, 10, 10, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_mu1_tetface") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_mu1_tetface") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 10) { goto __pyx_L5_argtuple_error; @@ -2518,6 +2713,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface( __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_6_mu1_tetface(__pyx_self, __pyx_v_Ds0s0, __pyx_v_Ds0s1, __pyx_v_Ds1s1, __pyx_v_Ds0t0, __pyx_v_Ds0t1, __pyx_v_Ds1t0, __pyx_v_Ds1t1, __pyx_v_Dt0t0, __pyx_v_Dt0t1, __pyx_v_Dt1t1); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":202 + * + * @cython.cdivision(True) + * cpdef double _mu1_tetface(double Ds0s0, # <<<<<<<<<<<<<< + * double Ds0s1, + * double Ds1s1, + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6_mu1_tetface(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_Ds0s0, double __pyx_v_Ds0s1, double __pyx_v_Ds1s1, double __pyx_v_Ds0t0, double __pyx_v_Ds0t1, double __pyx_v_Ds1t0, double __pyx_v_Ds1t1, double __pyx_v_Dt0t0, double __pyx_v_Dt0t1, double __pyx_v_Dt1t1) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_mu1_tetface", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol__mu1_tetface(__pyx_v_Ds0s0, __pyx_v_Ds0s1, __pyx_v_Ds1s1, __pyx_v_Ds0t0, __pyx_v_Ds0t1, __pyx_v_Ds1t0, __pyx_v_Ds1t1, __pyx_v_Dt0t0, __pyx_v_Dt0t1, __pyx_v_Dt1t1, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2545,8 +2761,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface( * double D22) nogil: */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_9mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_C00; double __pyx_v_C01; double __pyx_v_C11; @@ -2628,37 +2844,26 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri(double __p return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":238 - * - * - * cpdef double mu2_tri(double D00, double D01, double D02, # <<<<<<<<<<<<<< - * double D11, double D12, - * double D22) nogil: - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_4mu2_tri[] = " Compute the 2nd intrinsic volume of triangle\n\n 2nd intrinsic volume (just area in this case) of a triangle with coordinates\n implied by the dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D22 : float\n ``cv2.dot(cv2)``\n\n Returns\n -------\n mu2 : float\n area of triangle\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_9mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_8mu2_tri[] = " Compute the 2nd intrinsic volume of triangle\n\n 2nd intrinsic volume (just area in this case) of a triangle with coordinates\n implied by the dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D22 : float\n ``cv2.dot(cv2)``\n\n Returns\n -------\n mu2 : float\n area of triangle\n "; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_9mu2_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D02; double __pyx_v_D11; double __pyx_v_D12; double __pyx_v_D22; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D22,0}; - __Pyx_RefNannySetupContext("mu2_tri"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu2_tri (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D22,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -2669,44 +2874,38 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tri", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tri", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tri", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tri", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu2_tri", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu2_tri") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu2_tri") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -2733,6 +2932,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_8mu2_tri(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D11, __pyx_v_D12, __pyx_v_D22); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":238 + * + * + * cpdef double mu2_tri(double D00, double D01, double D02, # <<<<<<<<<<<<<< + * double D11, double D12, + * double D22) nogil: + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8mu2_tri(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu2_tri", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri(__pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D11, __pyx_v_D12, __pyx_v_D22, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2760,8 +2980,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri(PyObj * double D22) nogil: */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_11mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_v_mu; double __pyx_r; @@ -2816,37 +3036,26 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri(double __p return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":279 - * - * - * cpdef double mu1_tri(double D00, double D01, double D02, # <<<<<<<<<<<<<< - * double D11, double D12, - * double D22) nogil: - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_5mu1_tri[] = " Compute the 1st intrinsic volume of triangle\n\n 1st intrinsic volume (1/2 the perimeter) of a triangle with coordinates\n implied by the dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D22 : float\n ``cv2.dot(cv2)``\n\n Returns\n -------\n mu1 : float\n 1/2 perimeter of triangle\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_11mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_10mu1_tri[] = " Compute the 1st intrinsic volume of triangle\n\n 1st intrinsic volume (1/2 the perimeter) of a triangle with coordinates\n implied by the dot products below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the first vertex, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the second\n vertex.\n D02 : float\n ``cv0.dot(cv2)``\n D11 : float\n ``cv1.dot(cv1)``\n D12 : float\n ``cv1.dot(cv2)``\n D22 : float\n ``cv2.dot(cv2)``\n\n Returns\n -------\n mu1 : float\n 1/2 perimeter of triangle\n "; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_11mu1_tri(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D02; double __pyx_v_D11; double __pyx_v_D12; double __pyx_v_D22; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D22,0}; - __Pyx_RefNannySetupContext("mu1_tri"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu1_tri (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D02,&__pyx_n_s__D11,&__pyx_n_s__D12,&__pyx_n_s__D22,0}; PyObject* values[6] = {0,0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -2857,44 +3066,38 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObj default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tri", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D02)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tri", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[3])) kw_args--; + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tri", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12); - if (likely(values[4])) kw_args--; + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D12)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tri", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22); - if (likely(values[5])) kw_args--; + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D22)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_tri", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu1_tri") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu1_tri") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -2921,6 +3124,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObj __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_10mu1_tri(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D11, __pyx_v_D12, __pyx_v_D22); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":279 + * + * + * cpdef double mu1_tri(double D00, double D01, double D02, # <<<<<<<<<<<<<< + * double D11, double D12, + * double D22) nogil: + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10mu1_tri(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D02, double __pyx_v_D11, double __pyx_v_D12, double __pyx_v_D22) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu1_tri", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri(__pyx_v_D00, __pyx_v_D01, __pyx_v_D02, __pyx_v_D11, __pyx_v_D12, __pyx_v_D22, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2948,8 +3172,8 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri(PyObj * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D11, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_13mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge(double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D11, CYTHON_UNUSED int __pyx_skip_dispatch) { double __pyx_r; /* "nipy/algorithms/statistics/intvol.pyx":337 @@ -2967,34 +3191,23 @@ static double __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge(double __ return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":316 - * - * - * cpdef double mu1_edge(double D00, double D01, double D11) nogil: # <<<<<<<<<<<<<< - * """ Compute the 1st intrinsic volume (length) of line segment - * - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_6mu1_edge[] = " Compute the 1st intrinsic volume (length) of line segment\n\n Length of a line segment with vertex coordinates implied by dot products\n below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the line start, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the line end.\n D11 : float\n ``cv1.dot(cv1)``\n\n Returns\n -------\n mu0 : float\n length of line segment\n "; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_13mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_12mu1_edge[] = " Compute the 1st intrinsic volume (length) of line segment\n\n Length of a line segment with vertex coordinates implied by dot products\n below.\n\n Parameters\n ----------\n D00 : float\n If ``cv0`` is a 3-vector of coordinates for the line start, `D00` is\n ``cv0.dot(cv0)``\n D01 : float\n ``cv0.dot(cv1)`` where ``cv1`` is the coordinates for the line end.\n D11 : float\n ``cv1.dot(cv1)``\n\n Returns\n -------\n mu0 : float\n length of line segment\n "; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_13mu1_edge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_D00; double __pyx_v_D01; double __pyx_v_D11; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D11,0}; - __Pyx_RefNannySetupContext("mu1_edge"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("mu1_edge (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__D00,&__pyx_n_s__D01,&__pyx_n_s__D11,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -3002,26 +3215,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyOb default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D00)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D01)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_edge", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__D11)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mu1_edge", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "mu1_edge") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "mu1_edge") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -3042,6 +3252,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyOb __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_12mu1_edge(__pyx_self, __pyx_v_D00, __pyx_v_D01, __pyx_v_D11); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":316 + * + * + * cpdef double mu1_edge(double D00, double D01, double D11) nogil: # <<<<<<<<<<<<<< + * """ Compute the 1st intrinsic volume (length) of line segment + * + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12mu1_edge(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_D00, double __pyx_v_D01, double __pyx_v_D11) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mu1_edge", 0); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = PyFloat_FromDouble(__pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge(__pyx_v_D00, __pyx_v_D01, __pyx_v_D11, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -3061,6 +3292,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyOb return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_15EC3d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_14EC3d[] = " Compute Euler characteristic of region within `mask`\n\n Given a 3d `mask`, compute the 0th intrinsic volume (Euler characteristic)\n of the masked region. The region is broken up into tetrahedra / triangles /\n edges / vertices, which are included based on whether all voxels in the\n tetrahedron / triangle / edge / vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,j,k), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it is not\n clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_15EC3d = {__Pyx_NAMESTR("EC3d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_15EC3d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_14EC3d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_15EC3d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("EC3d (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_14EC3d(__pyx_self, ((PyObject *)__pyx_v_mask)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":340 * * @@ -3069,10 +3313,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge(PyOb * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_7EC3d[] = " Compute Euler characteristic of region within `mask`\n\n Given a 3d `mask`, compute the 0th intrinsic volume (Euler characteristic)\n of the masked region. The region is broken up into tetrahedra / triangles /\n edges / vertices, which are included based on whether all voxels in the\n tetrahedron / triangle / edge / vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,j,k), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it is not\n clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_7EC3d = {__Pyx_NAMESTR("EC3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_7EC3d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14EC3d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mask) { PyArrayObject *__pyx_v_mask_c = 0; PyArrayObject *__pyx_v_fpmask = 0; PyArrayObject *__pyx_v_d2 = 0; @@ -3090,7 +3331,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject npy_intp __pyx_v_ds4; npy_intp __pyx_v_index; npy_intp __pyx_v_m; - npy_intp __pyx_v_nvox; + CYTHON_UNUSED npy_intp __pyx_v_nvox; npy_intp __pyx_v_ss0; npy_intp __pyx_v_ss1; npy_intp __pyx_v_ss2; @@ -3104,34 +3345,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject PyArrayObject *__pyx_v_strides = 0; PyObject *__pyx_v_union = NULL; PyObject *__pyx_v_c = NULL; - Py_buffer __pyx_bstruct_mask_c; - Py_ssize_t __pyx_bstride_0_mask_c = 0; - Py_ssize_t __pyx_bstride_1_mask_c = 0; - Py_ssize_t __pyx_bstride_2_mask_c = 0; - Py_ssize_t __pyx_bshape_0_mask_c = 0; - Py_ssize_t __pyx_bshape_1_mask_c = 0; - Py_ssize_t __pyx_bshape_2_mask_c = 0; - Py_buffer __pyx_bstruct_fpmask; - Py_ssize_t __pyx_bstride_0_fpmask = 0; - Py_ssize_t __pyx_bshape_0_fpmask = 0; - Py_buffer __pyx_bstruct_d4; - Py_ssize_t __pyx_bstride_0_d4 = 0; - Py_ssize_t __pyx_bstride_1_d4 = 0; - Py_ssize_t __pyx_bshape_0_d4 = 0; - Py_ssize_t __pyx_bshape_1_d4 = 0; - Py_buffer __pyx_bstruct_d2; - Py_ssize_t __pyx_bstride_0_d2 = 0; - Py_ssize_t __pyx_bstride_1_d2 = 0; - Py_ssize_t __pyx_bshape_0_d2 = 0; - Py_ssize_t __pyx_bshape_1_d2 = 0; - Py_buffer __pyx_bstruct_d3; - Py_ssize_t __pyx_bstride_0_d3 = 0; - Py_ssize_t __pyx_bstride_1_d3 = 0; - Py_ssize_t __pyx_bshape_0_d3 = 0; - Py_ssize_t __pyx_bshape_1_d3 = 0; - Py_buffer __pyx_bstruct_strides; - Py_ssize_t __pyx_bstride_0_strides = 0; - Py_ssize_t __pyx_bshape_0_strides = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d3; + __Pyx_Buffer __pyx_pybuffer_d3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d4; + __Pyx_Buffer __pyx_pybuffer_d4; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fpmask; + __Pyx_Buffer __pyx_pybuffer_fpmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask_c; + __Pyx_Buffer __pyx_pybuffer_mask_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_strides; + __Pyx_Buffer __pyx_pybuffer_strides; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3197,14 +3422,31 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("EC3d"); - __pyx_self = __pyx_self; - __pyx_bstruct_mask_c.buf = NULL; - __pyx_bstruct_fpmask.buf = NULL; - __pyx_bstruct_d2.buf = NULL; - __pyx_bstruct_d3.buf = NULL; - __pyx_bstruct_d4.buf = NULL; - __pyx_bstruct_strides.buf = NULL; + __Pyx_RefNannySetupContext("EC3d", 0); + __pyx_pybuffer_mask_c.pybuffer.buf = NULL; + __pyx_pybuffer_mask_c.refcount = 0; + __pyx_pybuffernd_mask_c.data = NULL; + __pyx_pybuffernd_mask_c.rcbuffer = &__pyx_pybuffer_mask_c; + __pyx_pybuffer_fpmask.pybuffer.buf = NULL; + __pyx_pybuffer_fpmask.refcount = 0; + __pyx_pybuffernd_fpmask.data = NULL; + __pyx_pybuffernd_fpmask.rcbuffer = &__pyx_pybuffer_fpmask; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_d3.pybuffer.buf = NULL; + __pyx_pybuffer_d3.refcount = 0; + __pyx_pybuffernd_d3.data = NULL; + __pyx_pybuffernd_d3.rcbuffer = &__pyx_pybuffer_d3; + __pyx_pybuffer_d4.pybuffer.buf = NULL; + __pyx_pybuffer_d4.refcount = 0; + __pyx_pybuffernd_d4.data = NULL; + __pyx_pybuffernd_d4.rcbuffer = &__pyx_pybuffer_d4; + __pyx_pybuffer_strides.pybuffer.buf = NULL; + __pyx_pybuffer_strides.refcount = 0; + __pyx_pybuffernd_strides.data = NULL; + __pyx_pybuffernd_strides.rcbuffer = &__pyx_pybuffer_strides; /* "nipy/algorithms/statistics/intvol.pyx":372 * Journal of the American Statistical Association, 102(479):913-928. @@ -3219,7 +3461,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -3228,7 +3470,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3239,7 +3481,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -3247,7 +3489,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -3272,9 +3514,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":389 * np.npy_intp ss0, ss1, ss2 # strides @@ -3296,19 +3538,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_6 = ((PyArrayObject *)__pyx_v_mask); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_mask_c = __pyx_bstruct_mask_c.strides[0]; __pyx_bstride_1_mask_c = __pyx_bstruct_mask_c.strides[1]; __pyx_bstride_2_mask_c = __pyx_bstruct_mask_c.strides[2]; - __pyx_bshape_0_mask_c = __pyx_bstruct_mask_c.shape[0]; __pyx_bshape_1_mask_c = __pyx_bstruct_mask_c.shape[1]; __pyx_bshape_2_mask_c = __pyx_bstruct_mask_c.shape[2]; + __pyx_pybuffernd_mask_c.diminfo[0].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask_c.diminfo[0].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask_c.diminfo[1].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask_c.diminfo[1].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mask_c.diminfo[2].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mask_c.diminfo[2].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[2]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; @@ -3330,7 +3571,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_3 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3362,7 +3603,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -3433,19 +3674,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_14 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_fpmask = __pyx_bstruct_fpmask.strides[0]; - __pyx_bshape_0_fpmask = __pyx_bstruct_fpmask.shape[0]; + __pyx_pybuffernd_fpmask.diminfo[0].strides = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fpmask.diminfo[0].shape = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_14 = 0; @@ -3472,7 +3712,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -3484,7 +3724,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -3497,7 +3737,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_15, ((PyObject *)__pyx_n_s__dtype), __pyx_t_16) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_16 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_15)); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -3506,19 +3746,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_17 = ((PyArrayObject *)__pyx_t_16); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_strides = __pyx_bstruct_strides.strides[0]; - __pyx_bshape_0_strides = __pyx_bstruct_strides.shape[0]; + __pyx_pybuffernd_strides.diminfo[0].strides = __pyx_pybuffernd_strides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_strides.diminfo[0].shape = __pyx_pybuffernd_strides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; @@ -3537,7 +3776,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_9)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_9)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); @@ -3559,7 +3798,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_10)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_k_tuple_10)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); @@ -3581,7 +3820,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_11)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_11)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); @@ -3603,7 +3842,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_12)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_k_tuple_12)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); @@ -3625,7 +3864,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_13)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_13)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); @@ -3647,7 +3886,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_15)); + __Pyx_GOTREF(__pyx_t_15); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_14)); PyTuple_SET_ITEM(__pyx_t_15, 0, ((PyObject *)__pyx_k_tuple_14)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); @@ -3669,7 +3908,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_15 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_15)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_15)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); @@ -3681,7 +3920,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(7); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -3723,7 +3962,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_22)); + __Pyx_GOTREF(__pyx_t_22); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_16)); PyTuple_SET_ITEM(__pyx_t_22, 0, ((PyObject *)__pyx_k_tuple_16)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); @@ -3757,7 +3996,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_union, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_21)); + __Pyx_GOTREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3766,7 +4005,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0; __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_21)); + __Pyx_GOTREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3774,7 +4013,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(((PyObject *)__pyx_t_21)); __pyx_t_21 = 0; __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_21)); + __Pyx_GOTREF(__pyx_t_21); PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3786,19 +4025,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_23 = ((PyArrayObject *)__pyx_t_16); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_d4 = __pyx_bstruct_d4.strides[0]; __pyx_bstride_1_d4 = __pyx_bstruct_d4.strides[1]; - __pyx_bshape_0_d4 = __pyx_bstruct_d4.shape[0]; __pyx_bshape_1_d4 = __pyx_bstruct_d4.shape[1]; + __pyx_pybuffernd_d4.diminfo[0].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d4.diminfo[0].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d4.diminfo[1].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d4.diminfo[1].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_23 = 0; @@ -3825,7 +4063,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_union, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3834,7 +4072,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_22); __pyx_t_22 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3842,7 +4080,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3854,19 +4092,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_24 = ((PyArrayObject *)__pyx_t_16); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_24, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_24 = 0; @@ -3893,7 +4130,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_16 = __Pyx_GetItemInt(__pyx_v_union, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_16); __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_22)); + __Pyx_GOTREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3902,7 +4139,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0; __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_22)); + __Pyx_GOTREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3910,7 +4147,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_GOTREF(__pyx_t_16); __Pyx_DECREF(((PyObject *)__pyx_t_22)); __pyx_t_22 = 0; __pyx_t_22 = PyTuple_New(1); if (unlikely(!__pyx_t_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_22)); + __Pyx_GOTREF(__pyx_t_22); PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_16); __pyx_t_16 = 0; @@ -3922,19 +4159,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_25 = ((PyArrayObject *)__pyx_t_16); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_25, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_25 = 0; @@ -3978,14 +4214,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_26 = 0; __pyx_t_7 = -1; if (__pyx_t_26 < 0) { - __pyx_t_26 += __pyx_bshape_0_strides; + __pyx_t_26 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_26 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_strides)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ss0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_26, __pyx_bstride_0_strides)); + __pyx_v_ss0 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_strides.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":425 * @@ -3997,14 +4233,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_27 = 1; __pyx_t_7 = -1; if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_strides; + __pyx_t_27 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_27 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_strides)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 425; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ss1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_27, __pyx_bstride_0_strides)); + __pyx_v_ss1 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_strides.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":426 * ss0 = strides[0] @@ -4016,14 +4252,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_28 = 2; __pyx_t_7 = -1; if (__pyx_t_28 < 0) { - __pyx_t_28 += __pyx_bshape_0_strides; + __pyx_t_28 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_strides)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 426; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ss2 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_28, __pyx_bstride_0_strides)); + __pyx_v_ss2 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_strides.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":428 * ss2 = strides[2] @@ -4102,18 +4338,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_35 = 0; __pyx_t_7 = -1; if (__pyx_t_34 < 0) { - __pyx_t_34 += __pyx_bshape_0_d4; + __pyx_t_34 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_34 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_34 >= __pyx_bshape_0_d4)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_35 < 0) { - __pyx_t_35 += __pyx_bshape_1_d4; + __pyx_t_35 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_35 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_35 >= __pyx_bshape_1_d4)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_34, __pyx_bstride_0_d4, __pyx_t_35, __pyx_bstride_1_d4))); + __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":436 * for l in range(ds4): @@ -4125,14 +4361,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_36 = __pyx_v_v0; __pyx_t_7 = -1; if (__pyx_t_36 < 0) { - __pyx_t_36 += __pyx_bshape_0_fpmask; + __pyx_t_36 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_36 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_36, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":437 * v0 = index + d4[l,0] @@ -4154,18 +4390,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_38 = 1; __pyx_t_7 = -1; if (__pyx_t_37 < 0) { - __pyx_t_37 += __pyx_bshape_0_d4; + __pyx_t_37 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_37 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_37 >= __pyx_bshape_0_d4)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_38 < 0) { - __pyx_t_38 += __pyx_bshape_1_d4; + __pyx_t_38 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_38 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_38 >= __pyx_bshape_1_d4)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_37, __pyx_bstride_0_d4, __pyx_t_38, __pyx_bstride_1_d4))); + __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":439 * if m: @@ -4178,18 +4414,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_40 = 2; __pyx_t_7 = -1; if (__pyx_t_39 < 0) { - __pyx_t_39 += __pyx_bshape_0_d4; + __pyx_t_39 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_39 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_39 >= __pyx_bshape_0_d4)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_40 < 0) { - __pyx_t_40 += __pyx_bshape_1_d4; + __pyx_t_40 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_40 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_40 >= __pyx_bshape_1_d4)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v2 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_39, __pyx_bstride_0_d4, __pyx_t_40, __pyx_bstride_1_d4))); + __pyx_v_v2 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":440 * v1 = index + d4[l,1] @@ -4202,18 +4438,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_42 = 3; __pyx_t_7 = -1; if (__pyx_t_41 < 0) { - __pyx_t_41 += __pyx_bshape_0_d4; + __pyx_t_41 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_41 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_41 >= __pyx_bshape_0_d4)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_42 < 0) { - __pyx_t_42 += __pyx_bshape_1_d4; + __pyx_t_42 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_42 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_42 >= __pyx_bshape_1_d4)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v3 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_41, __pyx_bstride_0_d4, __pyx_t_42, __pyx_bstride_1_d4))); + __pyx_v_v3 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":441 * v2 = index + d4[l,2] @@ -4225,9 +4461,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_43 = __pyx_v_v1; __pyx_t_7 = -1; if (__pyx_t_43 < 0) { - __pyx_t_43 += __pyx_bshape_0_fpmask; + __pyx_t_43 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_43 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_43 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_43 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4235,9 +4471,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_44 = __pyx_v_v2; __pyx_t_7 = -1; if (__pyx_t_44 < 0) { - __pyx_t_44 += __pyx_bshape_0_fpmask; + __pyx_t_44 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_44 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_44 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4245,14 +4481,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_45 = __pyx_v_v3; __pyx_t_7 = -1; if (__pyx_t_45 < 0) { - __pyx_t_45 += __pyx_bshape_0_fpmask; + __pyx_t_45 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_45 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_45 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_43, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_44, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_45, __pyx_bstride_0_fpmask))); + __pyx_v_m = (((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":442 * v3 = index + d4[l,3] @@ -4262,9 +4498,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject * for l in range(ds3): */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L14; + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; } /* "nipy/algorithms/statistics/intvol.pyx":444 @@ -4289,18 +4525,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_47 = 0; __pyx_t_7 = -1; if (__pyx_t_46 < 0) { - __pyx_t_46 += __pyx_bshape_0_d3; + __pyx_t_46 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_46 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_46 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_47 < 0) { - __pyx_t_47 += __pyx_bshape_1_d3; + __pyx_t_47 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_47 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_47 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_46, __pyx_bstride_0_d3, __pyx_t_47, __pyx_bstride_1_d3))); + __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":446 * for l in range(ds3): @@ -4312,14 +4548,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_48 = __pyx_v_v0; __pyx_t_7 = -1; if (__pyx_t_48 < 0) { - __pyx_t_48 += __pyx_bshape_0_fpmask; + __pyx_t_48 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_48 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_48 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 446; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_48, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":447 * v0 = index + d3[l,0] @@ -4341,18 +4577,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_50 = 1; __pyx_t_7 = -1; if (__pyx_t_49 < 0) { - __pyx_t_49 += __pyx_bshape_0_d3; + __pyx_t_49 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_49 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_49 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_50 < 0) { - __pyx_t_50 += __pyx_bshape_1_d3; + __pyx_t_50 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_50 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_50 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_49, __pyx_bstride_0_d3, __pyx_t_50, __pyx_bstride_1_d3))); + __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_50, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":449 * if m: @@ -4365,18 +4601,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_52 = 2; __pyx_t_7 = -1; if (__pyx_t_51 < 0) { - __pyx_t_51 += __pyx_bshape_0_d3; + __pyx_t_51 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_51 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_51 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_52 < 0) { - __pyx_t_52 += __pyx_bshape_1_d3; + __pyx_t_52 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_52 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_52 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v2 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_51, __pyx_bstride_0_d3, __pyx_t_52, __pyx_bstride_1_d3))); + __pyx_v_v2 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_52, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":450 * v1 = index + d3[l,1] @@ -4388,9 +4624,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_53 = __pyx_v_v1; __pyx_t_7 = -1; if (__pyx_t_53 < 0) { - __pyx_t_53 += __pyx_bshape_0_fpmask; + __pyx_t_53 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_53 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_53 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4398,14 +4634,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_54 = __pyx_v_v2; __pyx_t_7 = -1; if (__pyx_t_54 < 0) { - __pyx_t_54 += __pyx_bshape_0_fpmask; + __pyx_t_54 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_54 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_53, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_54, __pyx_bstride_0_fpmask))); + __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":451 * v2 = index + d3[l,2] @@ -4415,9 +4651,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject * for l in range(ds2): */ __pyx_v_l0 = (__pyx_v_l0 + __pyx_v_m); - goto __pyx_L17; + goto __pyx_L15; } - __pyx_L17:; + __pyx_L15:; } /* "nipy/algorithms/statistics/intvol.pyx":453 @@ -4442,18 +4678,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_56 = 0; __pyx_t_7 = -1; if (__pyx_t_55 < 0) { - __pyx_t_55 += __pyx_bshape_0_d2; + __pyx_t_55 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_55 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_55 >= __pyx_bshape_0_d2)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_56 < 0) { - __pyx_t_56 += __pyx_bshape_1_d2; + __pyx_t_56 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_56 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_56 >= __pyx_bshape_1_d2)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 454; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_55, __pyx_bstride_0_d2, __pyx_t_56, __pyx_bstride_1_d2))); + __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_56, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":455 * for l in range(ds2): @@ -4465,14 +4701,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_57 = __pyx_v_v0; __pyx_t_7 = -1; if (__pyx_t_57 < 0) { - __pyx_t_57 += __pyx_bshape_0_fpmask; + __pyx_t_57 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_57 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_57 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_57, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":456 * v0 = index + d2[l,0] @@ -4494,18 +4730,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_59 = 1; __pyx_t_7 = -1; if (__pyx_t_58 < 0) { - __pyx_t_58 += __pyx_bshape_0_d2; + __pyx_t_58 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_58 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_d2)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_59 < 0) { - __pyx_t_59 += __pyx_bshape_1_d2; + __pyx_t_59 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_59 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_59 >= __pyx_bshape_1_d2)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_58, __pyx_bstride_0_d2, __pyx_t_59, __pyx_bstride_1_d2))); + __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":458 * if m: @@ -4517,14 +4753,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __pyx_t_60 = __pyx_v_v1; __pyx_t_7 = -1; if (__pyx_t_60 < 0) { - __pyx_t_60 += __pyx_bshape_0_fpmask; + __pyx_t_60 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_60 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_60, __pyx_bstride_0_fpmask))); + __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":459 * v1 = index + d2[l,1] @@ -4534,9 +4770,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject * return l0 */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L20; + goto __pyx_L18; } - __pyx_L20:; + __pyx_L18:; } } } @@ -4593,23 +4829,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject __Pyx_XDECREF(__pyx_t_22); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.EC3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_mask_c); __Pyx_XDECREF((PyObject *)__pyx_v_fpmask); @@ -4626,6 +4862,64 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_17Lips3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_16Lips3d[] = " Estimated intrinsic volumes within masked region given coordinates\n\n Given a 3d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into tetrahedra / triangles /\n edges / vertices, which are included based on whether all voxels in the\n tetrahedron / triangle / edge / vertex are in the mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 3 (for 3\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,j,k), np.int)\n Binary mask determining whether or not\n a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1, mu2, mu3], being, respectively:\n #. Euler characteristic\n #. 2 * mean caliper diameter\n #. 0.5 * surface area\n #. Volume.\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_17Lips3d = {__Pyx_NAMESTR("Lips3d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_17Lips3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_16Lips3d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_17Lips3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_coords = 0; + PyObject *__pyx_v_mask = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Lips3d (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Lips3d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Lips3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_coords = values[0]; + __pyx_v_mask = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Lips3d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips3d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_16Lips3d(__pyx_self, __pyx_v_coords, __pyx_v_mask); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":464 * * @@ -4634,12 +4928,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_7EC3d(PyObject * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_8Lips3d[] = " Estimated intrinsic volumes within masked region given coordinates\n\n Given a 3d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into tetrahedra / triangles /\n edges / vertices, which are included based on whether all voxels in the\n tetrahedron / triangle / edge / vertex are in the mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 3 (for 3\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,j,k), np.int)\n Binary mask determining whether or not\n a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1, mu2, mu3], being, respectively:\n #. Euler characteristic\n #. 2 * mean caliper diameter\n #. 0.5 * surface area\n #. Volume.\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_8Lips3d = {__Pyx_NAMESTR("Lips3d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_8Lips3d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_coords = 0; - PyObject *__pyx_v_mask = 0; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_16Lips3d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coords, PyObject *__pyx_v_mask) { PyObject *__pyx_v_value = NULL; PyArrayObject *__pyx_v_coords_c = 0; PyArrayObject *__pyx_v_mask_c = 0; @@ -4701,84 +4990,38 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje PyObject *__pyx_v_union = NULL; PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_v = NULL; - Py_buffer __pyx_bstruct_mask_c; - Py_ssize_t __pyx_bstride_0_mask_c = 0; - Py_ssize_t __pyx_bstride_1_mask_c = 0; - Py_ssize_t __pyx_bstride_2_mask_c = 0; - Py_ssize_t __pyx_bshape_0_mask_c = 0; - Py_ssize_t __pyx_bshape_1_mask_c = 0; - Py_ssize_t __pyx_bshape_2_mask_c = 0; - Py_buffer __pyx_bstruct_fpmask; - Py_ssize_t __pyx_bstride_0_fpmask = 0; - Py_ssize_t __pyx_bshape_0_fpmask = 0; - Py_buffer __pyx_bstruct_d4; - Py_ssize_t __pyx_bstride_0_d4 = 0; - Py_ssize_t __pyx_bstride_1_d4 = 0; - Py_ssize_t __pyx_bshape_0_d4 = 0; - Py_ssize_t __pyx_bshape_1_d4 = 0; - Py_buffer __pyx_bstruct_d2; - Py_ssize_t __pyx_bstride_0_d2 = 0; - Py_ssize_t __pyx_bstride_1_d2 = 0; - Py_ssize_t __pyx_bshape_0_d2 = 0; - Py_ssize_t __pyx_bshape_1_d2 = 0; - Py_buffer __pyx_bstruct_d3; - Py_ssize_t __pyx_bstride_0_d3 = 0; - Py_ssize_t __pyx_bstride_1_d3 = 0; - Py_ssize_t __pyx_bshape_0_d3 = 0; - Py_ssize_t __pyx_bshape_1_d3 = 0; - Py_buffer __pyx_bstruct_cvertices; - Py_ssize_t __pyx_bstride_0_cvertices = 0; - Py_ssize_t __pyx_bshape_0_cvertices = 0; - Py_buffer __pyx_bstruct_coords_c; - Py_ssize_t __pyx_bstride_0_coords_c = 0; - Py_ssize_t __pyx_bstride_1_coords_c = 0; - Py_ssize_t __pyx_bstride_2_coords_c = 0; - Py_ssize_t __pyx_bstride_3_coords_c = 0; - Py_ssize_t __pyx_bshape_0_coords_c = 0; - Py_ssize_t __pyx_bshape_1_coords_c = 0; - Py_ssize_t __pyx_bshape_2_coords_c = 0; - Py_ssize_t __pyx_bshape_3_coords_c = 0; - Py_buffer __pyx_bstruct_m4; - Py_ssize_t __pyx_bstride_0_m4 = 0; - Py_ssize_t __pyx_bstride_1_m4 = 0; - Py_ssize_t __pyx_bshape_0_m4 = 0; - Py_ssize_t __pyx_bshape_1_m4 = 0; - Py_buffer __pyx_bstruct_m3; - Py_ssize_t __pyx_bstride_0_m3 = 0; - Py_ssize_t __pyx_bstride_1_m3 = 0; - Py_ssize_t __pyx_bshape_0_m3 = 0; - Py_ssize_t __pyx_bshape_1_m3 = 0; - Py_buffer __pyx_bstruct_m2; - Py_ssize_t __pyx_bstride_0_m2 = 0; - Py_ssize_t __pyx_bstride_1_m2 = 0; - Py_ssize_t __pyx_bshape_0_m2 = 0; - Py_ssize_t __pyx_bshape_1_m2 = 0; - Py_buffer __pyx_bstruct_pmask; - Py_ssize_t __pyx_bstride_0_pmask = 0; - Py_ssize_t __pyx_bstride_1_pmask = 0; - Py_ssize_t __pyx_bstride_2_pmask = 0; - Py_ssize_t __pyx_bshape_0_pmask = 0; - Py_ssize_t __pyx_bshape_1_pmask = 0; - Py_ssize_t __pyx_bshape_2_pmask = 0; - Py_buffer __pyx_bstruct_D; - Py_ssize_t __pyx_bstride_0_D = 0; - Py_ssize_t __pyx_bstride_1_D = 0; - Py_ssize_t __pyx_bshape_0_D = 0; - Py_ssize_t __pyx_bshape_1_D = 0; - Py_buffer __pyx_bstruct_dstrides; - Py_ssize_t __pyx_bstride_0_dstrides = 0; - Py_ssize_t __pyx_bshape_0_dstrides = 0; - Py_buffer __pyx_bstruct_strides; - Py_ssize_t __pyx_bstride_0_strides = 0; - Py_ssize_t __pyx_bshape_0_strides = 0; - Py_buffer __pyx_bstruct_fcoords; - Py_ssize_t __pyx_bstride_0_fcoords = 0; - Py_ssize_t __pyx_bstride_1_fcoords = 0; - Py_ssize_t __pyx_bshape_0_fcoords = 0; - Py_ssize_t __pyx_bshape_1_fcoords = 0; - Py_buffer __pyx_bstruct_fmask; - Py_ssize_t __pyx_bstride_0_fmask = 0; - Py_ssize_t __pyx_bshape_0_fmask = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_D; + __Pyx_Buffer __pyx_pybuffer_D; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coords_c; + __Pyx_Buffer __pyx_pybuffer_coords_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_cvertices; + __Pyx_Buffer __pyx_pybuffer_cvertices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d3; + __Pyx_Buffer __pyx_pybuffer_d3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d4; + __Pyx_Buffer __pyx_pybuffer_d4; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dstrides; + __Pyx_Buffer __pyx_pybuffer_dstrides; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fcoords; + __Pyx_Buffer __pyx_pybuffer_fcoords; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fmask; + __Pyx_Buffer __pyx_pybuffer_fmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fpmask; + __Pyx_Buffer __pyx_pybuffer_fpmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_m2; + __Pyx_Buffer __pyx_pybuffer_m2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_m3; + __Pyx_Buffer __pyx_pybuffer_m3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_m4; + __Pyx_Buffer __pyx_pybuffer_m4; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask_c; + __Pyx_Buffer __pyx_pybuffer_mask_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pmask; + __Pyx_Buffer __pyx_pybuffer_pmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_strides; + __Pyx_Buffer __pyx_pybuffer_strides; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4988,70 +5231,73 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; - __Pyx_RefNannySetupContext("Lips3d"); - __pyx_self = __pyx_self; - { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Lips3d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Lips3d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coords = values[0]; - __pyx_v_mask = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Lips3d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips3d", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("Lips3d", 0); __Pyx_INCREF(__pyx_v_coords); __Pyx_INCREF(__pyx_v_mask); - __pyx_bstruct_coords_c.buf = NULL; - __pyx_bstruct_mask_c.buf = NULL; - __pyx_bstruct_fcoords.buf = NULL; - __pyx_bstruct_D.buf = NULL; - __pyx_bstruct_fmask.buf = NULL; - __pyx_bstruct_fpmask.buf = NULL; - __pyx_bstruct_pmask.buf = NULL; - __pyx_bstruct_d4.buf = NULL; - __pyx_bstruct_m4.buf = NULL; - __pyx_bstruct_d3.buf = NULL; - __pyx_bstruct_m3.buf = NULL; - __pyx_bstruct_d2.buf = NULL; - __pyx_bstruct_m2.buf = NULL; - __pyx_bstruct_cvertices.buf = NULL; - __pyx_bstruct_strides.buf = NULL; - __pyx_bstruct_dstrides.buf = NULL; + __pyx_pybuffer_coords_c.pybuffer.buf = NULL; + __pyx_pybuffer_coords_c.refcount = 0; + __pyx_pybuffernd_coords_c.data = NULL; + __pyx_pybuffernd_coords_c.rcbuffer = &__pyx_pybuffer_coords_c; + __pyx_pybuffer_mask_c.pybuffer.buf = NULL; + __pyx_pybuffer_mask_c.refcount = 0; + __pyx_pybuffernd_mask_c.data = NULL; + __pyx_pybuffernd_mask_c.rcbuffer = &__pyx_pybuffer_mask_c; + __pyx_pybuffer_fcoords.pybuffer.buf = NULL; + __pyx_pybuffer_fcoords.refcount = 0; + __pyx_pybuffernd_fcoords.data = NULL; + __pyx_pybuffernd_fcoords.rcbuffer = &__pyx_pybuffer_fcoords; + __pyx_pybuffer_D.pybuffer.buf = NULL; + __pyx_pybuffer_D.refcount = 0; + __pyx_pybuffernd_D.data = NULL; + __pyx_pybuffernd_D.rcbuffer = &__pyx_pybuffer_D; + __pyx_pybuffer_fmask.pybuffer.buf = NULL; + __pyx_pybuffer_fmask.refcount = 0; + __pyx_pybuffernd_fmask.data = NULL; + __pyx_pybuffernd_fmask.rcbuffer = &__pyx_pybuffer_fmask; + __pyx_pybuffer_fpmask.pybuffer.buf = NULL; + __pyx_pybuffer_fpmask.refcount = 0; + __pyx_pybuffernd_fpmask.data = NULL; + __pyx_pybuffernd_fpmask.rcbuffer = &__pyx_pybuffer_fpmask; + __pyx_pybuffer_pmask.pybuffer.buf = NULL; + __pyx_pybuffer_pmask.refcount = 0; + __pyx_pybuffernd_pmask.data = NULL; + __pyx_pybuffernd_pmask.rcbuffer = &__pyx_pybuffer_pmask; + __pyx_pybuffer_d4.pybuffer.buf = NULL; + __pyx_pybuffer_d4.refcount = 0; + __pyx_pybuffernd_d4.data = NULL; + __pyx_pybuffernd_d4.rcbuffer = &__pyx_pybuffer_d4; + __pyx_pybuffer_m4.pybuffer.buf = NULL; + __pyx_pybuffer_m4.refcount = 0; + __pyx_pybuffernd_m4.data = NULL; + __pyx_pybuffernd_m4.rcbuffer = &__pyx_pybuffer_m4; + __pyx_pybuffer_d3.pybuffer.buf = NULL; + __pyx_pybuffer_d3.refcount = 0; + __pyx_pybuffernd_d3.data = NULL; + __pyx_pybuffernd_d3.rcbuffer = &__pyx_pybuffer_d3; + __pyx_pybuffer_m3.pybuffer.buf = NULL; + __pyx_pybuffer_m3.refcount = 0; + __pyx_pybuffernd_m3.data = NULL; + __pyx_pybuffernd_m3.rcbuffer = &__pyx_pybuffer_m3; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_m2.pybuffer.buf = NULL; + __pyx_pybuffer_m2.refcount = 0; + __pyx_pybuffernd_m2.data = NULL; + __pyx_pybuffernd_m2.rcbuffer = &__pyx_pybuffer_m2; + __pyx_pybuffer_cvertices.pybuffer.buf = NULL; + __pyx_pybuffer_cvertices.refcount = 0; + __pyx_pybuffernd_cvertices.data = NULL; + __pyx_pybuffernd_cvertices.rcbuffer = &__pyx_pybuffer_cvertices; + __pyx_pybuffer_strides.pybuffer.buf = NULL; + __pyx_pybuffer_strides.refcount = 0; + __pyx_pybuffernd_strides.data = NULL; + __pyx_pybuffernd_strides.rcbuffer = &__pyx_pybuffer_strides; + __pyx_pybuffer_dstrides.pybuffer.buf = NULL; + __pyx_pybuffer_dstrides.refcount = 0; + __pyx_pybuffernd_dstrides.data = NULL; + __pyx_pybuffernd_dstrides.rcbuffer = &__pyx_pybuffer_dstrides; /* "nipy/algorithms/statistics/intvol.pyx":504 * Journal of the American Statistical Association, 102(479):913-928. @@ -5067,8 +5313,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_t_2, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5087,9 +5332,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":507 * raise ValueError('shape of mask does not match coordinates') @@ -5104,7 +5349,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -5125,8 +5370,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -5165,7 +5409,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5176,7 +5420,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5197,8 +5441,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje */ __pyx_t_5 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ndim); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5214,7 +5457,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__Lips2d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_coords); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_coords); __Pyx_GIVEREF(__pyx_v_coords); @@ -5225,9 +5468,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 3, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L8; + goto __pyx_L5; } /* "nipy/algorithms/statistics/intvol.pyx":513 @@ -5239,8 +5482,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje */ __pyx_t_2 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_2, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5256,7 +5498,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__Lips1d); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_coords); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_coords); __Pyx_GIVEREF(__pyx_v_coords); @@ -5267,11 +5509,11 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; /* "nipy/algorithms/statistics/intvol.pyx":515 * elif mask.ndim == 1: @@ -5284,9 +5526,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_INCREF(__pyx_v_value); __pyx_r = __pyx_v_value; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; /* "nipy/algorithms/statistics/intvol.pyx":517 * return value @@ -5301,7 +5543,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -5310,7 +5552,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5321,7 +5563,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -5329,7 +5571,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -5354,9 +5596,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L9; + goto __pyx_L6; } - __pyx_L9:; + __pyx_L6:; /* "nipy/algorithms/statistics/intvol.pyx":549 * double res @@ -5369,19 +5611,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_7 = ((PyArrayObject *)__pyx_v_coords); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_coords_c, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coords_c, (PyObject*)__pyx_v_coords_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_coords_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 4, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_coords_c = __pyx_bstruct_coords_c.strides[0]; __pyx_bstride_1_coords_c = __pyx_bstruct_coords_c.strides[1]; __pyx_bstride_2_coords_c = __pyx_bstruct_coords_c.strides[2]; __pyx_bstride_3_coords_c = __pyx_bstruct_coords_c.strides[3]; - __pyx_bshape_0_coords_c = __pyx_bstruct_coords_c.shape[0]; __pyx_bshape_1_coords_c = __pyx_bstruct_coords_c.shape[1]; __pyx_bshape_2_coords_c = __pyx_bstruct_coords_c.shape[2]; __pyx_bshape_3_coords_c = __pyx_bstruct_coords_c.shape[3]; + __pyx_pybuffernd_coords_c.diminfo[0].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coords_c.diminfo[0].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coords_c.diminfo[1].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coords_c.diminfo[1].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coords_c.diminfo[2].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coords_c.diminfo[2].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[2]; __pyx_pybuffernd_coords_c.diminfo[3].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[3]; __pyx_pybuffernd_coords_c.diminfo[3].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[3]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; @@ -5399,19 +5640,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_12 = ((PyArrayObject *)__pyx_v_mask); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_mask_c = __pyx_bstruct_mask_c.strides[0]; __pyx_bstride_1_mask_c = __pyx_bstruct_mask_c.strides[1]; __pyx_bstride_2_mask_c = __pyx_bstruct_mask_c.strides[2]; - __pyx_bshape_0_mask_c = __pyx_bstruct_mask_c.shape[0]; __pyx_bshape_1_mask_c = __pyx_bstruct_mask_c.shape[1]; __pyx_bshape_2_mask_c = __pyx_bstruct_mask_c.shape[2]; + __pyx_pybuffernd_mask_c.diminfo[0].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask_c.diminfo[0].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask_c.diminfo[1].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask_c.diminfo[1].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mask_c.diminfo[2].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mask_c.diminfo[2].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[2]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; @@ -5445,7 +5685,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5477,7 +5717,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -5492,19 +5732,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_13 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_pmask = __pyx_bstruct_pmask.strides[0]; __pyx_bstride_1_pmask = __pyx_bstruct_pmask.strides[1]; __pyx_bstride_2_pmask = __pyx_bstruct_pmask.strides[2]; - __pyx_bshape_0_pmask = __pyx_bstruct_pmask.shape[0]; __pyx_bshape_1_pmask = __pyx_bstruct_pmask.shape[1]; __pyx_bshape_2_pmask = __pyx_bstruct_pmask.shape[2]; + __pyx_pybuffernd_pmask.diminfo[0].strides = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pmask.diminfo[0].shape = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pmask.diminfo[1].strides = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pmask.diminfo[1].shape = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_pmask.diminfo[2].strides = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_pmask.diminfo[2].shape = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.shape[2]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = 0; @@ -5550,19 +5789,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_17 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_fpmask = __pyx_bstruct_fpmask.strides[0]; - __pyx_bshape_0_fpmask = __pyx_bstruct_fpmask.shape[0]; + __pyx_pybuffernd_fpmask.diminfo[0].strides = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fpmask.diminfo[0].shape = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; @@ -5585,19 +5823,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_18 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fmask, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fmask, (PyObject*)__pyx_v_fmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_fmask = __pyx_bstruct_fmask.strides[0]; - __pyx_bshape_0_fmask = __pyx_bstruct_fmask.shape[0]; + __pyx_pybuffernd_fmask.diminfo[0].strides = __pyx_pybuffernd_fmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fmask.diminfo[0].shape = __pyx_pybuffernd_fmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_18 = 0; @@ -5616,7 +5853,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_coords_c->dimensions[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_neg_1); @@ -5624,7 +5861,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GIVEREF(__pyx_int_neg_1); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -5636,19 +5873,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_19 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fcoords, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer, (PyObject*)__pyx_t_19, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fcoords, (PyObject*)__pyx_v_fcoords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer, (PyObject*)__pyx_v_fcoords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_fcoords = __pyx_bstruct_fcoords.strides[0]; __pyx_bstride_1_fcoords = __pyx_bstruct_fcoords.strides[1]; - __pyx_bshape_0_fcoords = __pyx_bstruct_fcoords.shape[0]; __pyx_bshape_1_fcoords = __pyx_bstruct_fcoords.shape[1]; + __pyx_pybuffernd_fcoords.diminfo[0].strides = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fcoords.diminfo[0].shape = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fcoords.diminfo[1].strides = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fcoords.diminfo[1].shape = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_19 = 0; @@ -5675,7 +5911,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -5687,7 +5923,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5700,7 +5936,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_20) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_20 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_20); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -5709,19 +5945,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_21 = ((PyArrayObject *)__pyx_t_20); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_strides = __pyx_bstruct_strides.strides[0]; - __pyx_bshape_0_strides = __pyx_bstruct_strides.shape[0]; + __pyx_pybuffernd_strides.diminfo[0].strides = __pyx_pybuffernd_strides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_strides.diminfo[0].shape = __pyx_pybuffernd_strides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_21 = 0; @@ -5750,7 +5985,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); @@ -5762,7 +5997,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -5775,7 +6010,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -5784,19 +6019,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_22 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dstrides, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dstrides, (PyObject*)__pyx_v_dstrides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer, (PyObject*)__pyx_v_dstrides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_dstrides = __pyx_bstruct_dstrides.strides[0]; - __pyx_bshape_0_dstrides = __pyx_bstruct_dstrides.shape[0]; + __pyx_pybuffernd_dstrides.diminfo[0].strides = __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dstrides.diminfo[0].shape = __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_22 = 0; @@ -5813,36 +6047,36 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_23 = 0; __pyx_t_8 = -1; if (__pyx_t_23 < 0) { - __pyx_t_23 += __pyx_bshape_0_strides; + __pyx_t_23 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_23 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_23 >= __pyx_bshape_0_strides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_23 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_24 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_23, __pyx_bstride_0_strides)); + __pyx_t_24 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_t_25 = 1; __pyx_t_8 = -1; if (__pyx_t_25 < 0) { - __pyx_t_25 += __pyx_bshape_0_strides; + __pyx_t_25 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_25 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_25 >= __pyx_bshape_0_strides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_25 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_25, __pyx_bstride_0_strides)); + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_t_27 = 2; __pyx_t_8 = -1; if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_strides; + __pyx_t_27 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_27 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_strides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_27, __pyx_bstride_0_strides)); + __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_v_ss0 = __pyx_t_24; __pyx_v_ss1 = __pyx_t_26; __pyx_v_ss2 = __pyx_t_28; @@ -5857,38 +6091,38 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_29 = 0; __pyx_t_8 = -1; if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_0_dstrides; + __pyx_t_29 += __pyx_pybuffernd_dstrides.diminfo[0].shape; if (unlikely(__pyx_t_29 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_0_dstrides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_dstrides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_dstrides.buf, __pyx_t_29, __pyx_bstride_0_dstrides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_dstrides.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_30 = 1; __pyx_t_8 = -1; if (__pyx_t_30 < 0) { - __pyx_t_30 += __pyx_bshape_0_dstrides; + __pyx_t_30 += __pyx_pybuffernd_dstrides.diminfo[0].shape; if (unlikely(__pyx_t_30 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_dstrides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_dstrides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_dstrides.buf, __pyx_t_30, __pyx_bstride_0_dstrides))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_dstrides.diminfo[0].strides))); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_31 = 2; __pyx_t_8 = -1; if (__pyx_t_31 < 0) { - __pyx_t_31 += __pyx_bshape_0_dstrides; + __pyx_t_31 += __pyx_pybuffernd_dstrides.diminfo[0].shape; if (unlikely(__pyx_t_31 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_dstrides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_dstrides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_dstrides.buf, __pyx_t_31, __pyx_bstride_0_dstrides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_dstrides.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_ss0d = __pyx_t_2; __pyx_t_2 = 0; @@ -5905,7 +6139,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje * for j in range(2): */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __pyx_v_verts = __pyx_t_3; __pyx_t_3 = 0; @@ -5946,9 +6180,6 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje * cvertices = np.array(sorted(verts), np.intp) * */ - if (unlikely(((PyObject *)__pyx_v_verts) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_i); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyNumber_Multiply(__pyx_v_ss0d, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5991,7 +6222,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_verts)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_verts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_verts)); @@ -6004,7 +6235,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); @@ -6019,19 +6250,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_33 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_cvertices, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer, (PyObject*)__pyx_t_33, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cvertices, (PyObject*)__pyx_v_cvertices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer, (PyObject*)__pyx_v_cvertices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_cvertices = __pyx_bstruct_cvertices.strides[0]; - __pyx_bshape_0_cvertices = __pyx_bstruct_cvertices.shape[0]; + __pyx_pybuffernd_cvertices.diminfo[0].strides = __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cvertices.diminfo[0].shape = __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_33 = 0; @@ -6050,7 +6280,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_27)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_k_tuple_27)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); @@ -6072,7 +6302,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_28)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_28)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); @@ -6094,7 +6324,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_29)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_k_tuple_29)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); @@ -6116,7 +6346,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_30)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_30)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); @@ -6138,7 +6368,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_31)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_k_tuple_31)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); @@ -6160,7 +6390,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_32)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_32)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); @@ -6182,7 +6412,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_33)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_k_tuple_33)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); @@ -6194,7 +6424,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyList_New(7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_5, 1, __pyx_t_20); @@ -6236,7 +6466,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_38 = PyTuple_New(2); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_34)); PyTuple_SET_ITEM(__pyx_t_38, 0, ((PyObject *)__pyx_k_tuple_34)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); @@ -6270,7 +6500,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_union, 4, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_37 = PyTuple_New(1); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_37)); + __Pyx_GOTREF(__pyx_t_37); PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6279,7 +6509,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; __pyx_t_37 = PyTuple_New(1); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_37)); + __Pyx_GOTREF(__pyx_t_37); PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6287,7 +6517,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; __pyx_t_37 = PyTuple_New(1); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_37)); + __Pyx_GOTREF(__pyx_t_37); PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6299,19 +6529,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_39 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m4); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_m4, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m4.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m4.rcbuffer->pybuffer, (PyObject*)__pyx_t_39, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_m4, (PyObject*)__pyx_v_m4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m4.rcbuffer->pybuffer, (PyObject*)__pyx_v_m4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_m4 = __pyx_bstruct_m4.strides[0]; __pyx_bstride_1_m4 = __pyx_bstruct_m4.strides[1]; - __pyx_bshape_0_m4 = __pyx_bstruct_m4.shape[0]; __pyx_bshape_1_m4 = __pyx_bstruct_m4.shape[1]; + __pyx_pybuffernd_m4.diminfo[0].strides = __pyx_pybuffernd_m4.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m4.diminfo[0].shape = __pyx_pybuffernd_m4.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m4.diminfo[1].strides = __pyx_pybuffernd_m4.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m4.diminfo[1].shape = __pyx_pybuffernd_m4.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_39 = 0; @@ -6338,7 +6567,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_union, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6347,7 +6576,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6355,7 +6584,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6367,19 +6596,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_40 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m3); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_m3, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m3.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m3.rcbuffer->pybuffer, (PyObject*)__pyx_t_40, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_m3, (PyObject*)__pyx_v_m3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m3.rcbuffer->pybuffer, (PyObject*)__pyx_v_m3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_m3 = __pyx_bstruct_m3.strides[0]; __pyx_bstride_1_m3 = __pyx_bstruct_m3.strides[1]; - __pyx_bshape_0_m3 = __pyx_bstruct_m3.shape[0]; __pyx_bshape_1_m3 = __pyx_bstruct_m3.shape[1]; + __pyx_pybuffernd_m3.diminfo[0].strides = __pyx_pybuffernd_m3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m3.diminfo[0].shape = __pyx_pybuffernd_m3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m3.diminfo[1].strides = __pyx_pybuffernd_m3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m3.diminfo[1].shape = __pyx_pybuffernd_m3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_40 = 0; @@ -6406,7 +6634,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_union, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6415,7 +6643,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_38)); __pyx_t_38 = 0; __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6423,7 +6651,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_38)); __pyx_t_38 = 0; __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6435,19 +6663,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_41 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m2); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_m2, (PyObject*)__pyx_t_41, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m2.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m2.rcbuffer->pybuffer, (PyObject*)__pyx_t_41, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_m2, (PyObject*)__pyx_v_m2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_m2.rcbuffer->pybuffer, (PyObject*)__pyx_v_m2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_m2 = __pyx_bstruct_m2.strides[0]; __pyx_bstride_1_m2 = __pyx_bstruct_m2.strides[1]; - __pyx_bshape_0_m2 = __pyx_bstruct_m2.shape[0]; __pyx_bshape_1_m2 = __pyx_bstruct_m2.shape[1]; + __pyx_pybuffernd_m2.diminfo[0].strides = __pyx_pybuffernd_m2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_m2.diminfo[0].shape = __pyx_pybuffernd_m2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_m2.diminfo[1].strides = __pyx_pybuffernd_m2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_m2.diminfo[1].shape = __pyx_pybuffernd_m2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_41 = 0; @@ -6467,12 +6694,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_38); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_16 = (__pyx_v_m4->dimensions[0]); for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __pyx_t_37 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m4), __pyx_v_i, sizeof(npy_intp), __Pyx_PyInt_to_py_Py_intptr_t); if (!__pyx_t_37) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); if (PyList_CheckExact(__pyx_t_37) || PyTuple_CheckExact(__pyx_t_37)) { @@ -6485,12 +6712,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje } __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_36)) { + if (!__pyx_t_43 && PyList_CheckExact(__pyx_t_36)) { if (__pyx_t_42 >= PyList_GET_SIZE(__pyx_t_36)) break; - __pyx_t_37 = PyList_GET_ITEM(__pyx_t_36, __pyx_t_42); __Pyx_INCREF(__pyx_t_37); __pyx_t_42++; - } else if (PyTuple_CheckExact(__pyx_t_36)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_37 = PyList_GET_ITEM(__pyx_t_36, __pyx_t_42); __Pyx_INCREF(__pyx_t_37); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_37 = PySequence_ITEM(__pyx_t_36, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_43 && PyTuple_CheckExact(__pyx_t_36)) { if (__pyx_t_42 >= PyTuple_GET_SIZE(__pyx_t_36)) break; - __pyx_t_37 = PyTuple_GET_ITEM(__pyx_t_36, __pyx_t_42); __Pyx_INCREF(__pyx_t_37); __pyx_t_42++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_37 = PyTuple_GET_ITEM(__pyx_t_36, __pyx_t_42); __Pyx_INCREF(__pyx_t_37); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_37 = PySequence_ITEM(__pyx_t_36, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_37 = __pyx_t_43(__pyx_t_36); if (unlikely(!__pyx_t_37)) { @@ -6508,7 +6743,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_37 = __Pyx_GetName(__pyx_m, __pyx_n_s___convert_stride3); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); __pyx_t_35 = PyTuple_New(3); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_35)); + __Pyx_GOTREF(__pyx_t_35); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); @@ -6522,15 +6757,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_34); __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_35)); __pyx_t_35 = 0; - if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_34))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_34))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; } __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -6543,19 +6778,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_44 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_d4 = __pyx_bstruct_d4.strides[0]; __pyx_bstride_1_d4 = __pyx_bstruct_d4.strides[1]; - __pyx_bshape_0_d4 = __pyx_bstruct_d4.shape[0]; __pyx_bshape_1_d4 = __pyx_bstruct_d4.shape[1]; + __pyx_pybuffernd_d4.diminfo[0].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d4.diminfo[0].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d4.diminfo[1].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d4.diminfo[1].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_44 = 0; @@ -6575,7 +6809,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_m4)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_m4)); __Pyx_GIVEREF(((PyObject *)__pyx_v_m4)); @@ -6583,7 +6817,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_d4)); __Pyx_GIVEREF(((PyObject *)__pyx_v_d4)); __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6595,19 +6829,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_44 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_t_44, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d4, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d4.rcbuffer->pybuffer, (PyObject*)__pyx_v_d4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_d4 = __pyx_bstruct_d4.strides[0]; __pyx_bstride_1_d4 = __pyx_bstruct_d4.strides[1]; - __pyx_bshape_0_d4 = __pyx_bstruct_d4.shape[0]; __pyx_bshape_1_d4 = __pyx_bstruct_d4.shape[1]; + __pyx_pybuffernd_d4.diminfo[0].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d4.diminfo[0].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d4.diminfo[1].strides = __pyx_pybuffernd_d4.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d4.diminfo[1].shape = __pyx_pybuffernd_d4.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_44 = 0; @@ -6637,12 +6870,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_38); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_16 = (__pyx_v_m3->dimensions[0]); for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __pyx_t_36 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m3), __pyx_v_i, sizeof(npy_intp), __Pyx_PyInt_to_py_Py_intptr_t); if (!__pyx_t_36) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_36); if (PyList_CheckExact(__pyx_t_36) || PyTuple_CheckExact(__pyx_t_36)) { @@ -6655,12 +6888,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje } __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_34)) { + if (!__pyx_t_43 && PyList_CheckExact(__pyx_t_34)) { if (__pyx_t_42 >= PyList_GET_SIZE(__pyx_t_34)) break; - __pyx_t_36 = PyList_GET_ITEM(__pyx_t_34, __pyx_t_42); __Pyx_INCREF(__pyx_t_36); __pyx_t_42++; - } else if (PyTuple_CheckExact(__pyx_t_34)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_36 = PyList_GET_ITEM(__pyx_t_34, __pyx_t_42); __Pyx_INCREF(__pyx_t_36); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_36 = PySequence_ITEM(__pyx_t_34, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_43 && PyTuple_CheckExact(__pyx_t_34)) { if (__pyx_t_42 >= PyTuple_GET_SIZE(__pyx_t_34)) break; - __pyx_t_36 = PyTuple_GET_ITEM(__pyx_t_34, __pyx_t_42); __Pyx_INCREF(__pyx_t_36); __pyx_t_42++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_36 = PyTuple_GET_ITEM(__pyx_t_34, __pyx_t_42); __Pyx_INCREF(__pyx_t_36); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_36 = PySequence_ITEM(__pyx_t_34, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_36 = __pyx_t_43(__pyx_t_34); if (unlikely(!__pyx_t_36)) { @@ -6678,7 +6919,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_36 = __Pyx_GetName(__pyx_m, __pyx_n_s___convert_stride3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_36); __pyx_t_35 = PyTuple_New(3); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_35)); + __Pyx_GOTREF(__pyx_t_35); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); @@ -6692,15 +6933,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_35)); __pyx_t_35 = 0; - if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_37))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_37))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; } __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -6713,19 +6954,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_45 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_45, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_45, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_45 = 0; @@ -6745,7 +6985,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_m3)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_m3)); __Pyx_GIVEREF(((PyObject *)__pyx_v_m3)); @@ -6753,7 +6993,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_d3)); __Pyx_GIVEREF(((PyObject *)__pyx_v_d3)); __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6765,19 +7005,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_45 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_45, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_45, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_45 = 0; @@ -6807,12 +7046,12 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_38); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_16 = (__pyx_v_m2->dimensions[0]); for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_16; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __pyx_t_34 = __Pyx_GetItemInt(((PyObject *)__pyx_v_m2), __pyx_v_i, sizeof(npy_intp), __Pyx_PyInt_to_py_Py_intptr_t); if (!__pyx_t_34) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); if (PyList_CheckExact(__pyx_t_34) || PyTuple_CheckExact(__pyx_t_34)) { @@ -6825,12 +7064,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje } __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_37)) { + if (!__pyx_t_43 && PyList_CheckExact(__pyx_t_37)) { if (__pyx_t_42 >= PyList_GET_SIZE(__pyx_t_37)) break; - __pyx_t_34 = PyList_GET_ITEM(__pyx_t_37, __pyx_t_42); __Pyx_INCREF(__pyx_t_34); __pyx_t_42++; - } else if (PyTuple_CheckExact(__pyx_t_37)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_34 = PyList_GET_ITEM(__pyx_t_37, __pyx_t_42); __Pyx_INCREF(__pyx_t_34); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_34 = PySequence_ITEM(__pyx_t_37, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_43 && PyTuple_CheckExact(__pyx_t_37)) { if (__pyx_t_42 >= PyTuple_GET_SIZE(__pyx_t_37)) break; - __pyx_t_34 = PyTuple_GET_ITEM(__pyx_t_37, __pyx_t_42); __Pyx_INCREF(__pyx_t_34); __pyx_t_42++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_34 = PyTuple_GET_ITEM(__pyx_t_37, __pyx_t_42); __Pyx_INCREF(__pyx_t_34); __pyx_t_42++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_34 = PySequence_ITEM(__pyx_t_37, __pyx_t_42); __pyx_t_42++; if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_34 = __pyx_t_43(__pyx_t_37); if (unlikely(!__pyx_t_34)) { @@ -6848,7 +7095,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_34 = __Pyx_GetName(__pyx_m, __pyx_n_s___convert_stride3); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __pyx_t_35 = PyTuple_New(3); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_35)); + __Pyx_GOTREF(__pyx_t_35); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_35, 0, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); @@ -6862,15 +7109,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_36); __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_35)); __pyx_t_35 = 0; - if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_36))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_36))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_36); __pyx_t_36 = 0; } __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -6883,19 +7130,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_46 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_46, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_46, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_46 = 0; @@ -6915,7 +7161,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_m2)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_m2)); __Pyx_GIVEREF(((PyObject *)__pyx_v_m2)); @@ -6923,7 +7169,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_d2)); __Pyx_GIVEREF(((PyObject *)__pyx_v_d2)); __pyx_t_38 = PyTuple_New(1); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_38)); + __Pyx_GOTREF(__pyx_t_38); PyTuple_SET_ITEM(__pyx_t_38, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6935,19 +7181,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_46 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_46, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_46, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 604; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_46 = 0; @@ -6996,19 +7241,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_47 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_D, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_t_47, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_D, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_D = __pyx_bstruct_D.strides[0]; __pyx_bstride_1_D = __pyx_bstruct_D.strides[1]; - __pyx_bshape_0_D = __pyx_bstruct_D.shape[0]; __pyx_bshape_1_D = __pyx_bstruct_D.shape[1]; + __pyx_pybuffernd_D.diminfo[0].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_D.diminfo[0].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_D.diminfo[1].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_D.diminfo[1].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_47 = 0; @@ -7111,14 +7355,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_52 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_52 < 0) { - __pyx_t_52 += __pyx_bshape_0_cvertices; + __pyx_t_52 += __pyx_pybuffernd_cvertices.diminfo[0].shape; if (unlikely(__pyx_t_52 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_52 >= __pyx_bshape_0_cvertices)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_cvertices.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_cvertices.buf, __pyx_t_52, __pyx_bstride_0_cvertices))); + __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_cvertices.diminfo[0].strides))); if (unlikely(__pyx_v_nvox == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7135,14 +7379,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_53 = __pyx_v_rr; __pyx_t_8 = -1; if (__pyx_t_53 < 0) { - __pyx_t_53 += __pyx_bshape_0_fmask; + __pyx_t_53 += __pyx_pybuffernd_fmask.diminfo[0].shape; if (unlikely(__pyx_t_53 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_53 >= __pyx_bshape_0_fmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_fmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fmask.buf, __pyx_t_53, __pyx_bstride_0_fmask)); + __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fmask.rcbuffer->pybuffer.buf, __pyx_t_53, __pyx_pybuffernd_fmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":620 * rr = (index+cvertices[r]) % nvox @@ -7174,14 +7418,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_56 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_56 < 0) { - __pyx_t_56 += __pyx_bshape_0_cvertices; + __pyx_t_56 += __pyx_pybuffernd_cvertices.diminfo[0].shape; if (unlikely(__pyx_t_56 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_cvertices)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_cvertices.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_cvertices.buf, __pyx_t_56, __pyx_bstride_0_cvertices))); + __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_cvertices.diminfo[0].strides))); if (unlikely(__pyx_v_nvox == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7198,14 +7442,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_57 = __pyx_v_ss; __pyx_t_8 = -1; if (__pyx_t_57 < 0) { - __pyx_t_57 += __pyx_bshape_0_fmask; + __pyx_t_57 += __pyx_pybuffernd_fmask.diminfo[0].shape; if (unlikely(__pyx_t_57 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_57 >= __pyx_bshape_0_fmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_fmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fmask.buf, __pyx_t_57, __pyx_bstride_0_fmask)); + __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fmask.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_fmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":624 * ss = (index+cvertices[s]) % nvox @@ -7239,13 +7483,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_61 = __pyx_v_ss; __pyx_t_8 = -1; if (__pyx_t_60 < 0) { - __pyx_t_60 += __pyx_bshape_0_fcoords; + __pyx_t_60 += __pyx_pybuffernd_fcoords.diminfo[0].shape; if (unlikely(__pyx_t_60 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_60 >= __pyx_bshape_0_fcoords)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_fcoords.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_61 < 0) { - __pyx_t_61 += __pyx_bshape_1_fcoords; + __pyx_t_61 += __pyx_pybuffernd_fcoords.diminfo[1].shape; if (unlikely(__pyx_t_61 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_61 >= __pyx_bshape_1_fcoords)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_fcoords.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7254,18 +7498,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_63 = __pyx_v_rr; __pyx_t_8 = -1; if (__pyx_t_62 < 0) { - __pyx_t_62 += __pyx_bshape_0_fcoords; + __pyx_t_62 += __pyx_pybuffernd_fcoords.diminfo[0].shape; if (unlikely(__pyx_t_62 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_fcoords)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_fcoords.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_63 < 0) { - __pyx_t_63 += __pyx_bshape_1_fcoords; + __pyx_t_63 += __pyx_pybuffernd_fcoords.diminfo[1].shape; if (unlikely(__pyx_t_63 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_63 >= __pyx_bshape_1_fcoords)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_fcoords.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_fcoords.buf, __pyx_t_60, __pyx_bstride_0_fcoords, __pyx_t_61, __pyx_bstride_1_fcoords)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_fcoords.buf, __pyx_t_62, __pyx_bstride_0_fcoords, __pyx_t_63, __pyx_bstride_1_fcoords)))); + __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_fcoords.diminfo[0].strides, __pyx_t_61, __pyx_pybuffernd_fcoords.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_fcoords.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_fcoords.diminfo[1].strides)))); } /* "nipy/algorithms/statistics/intvol.pyx":627 @@ -7279,18 +7523,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_59 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_58 < 0) { - __pyx_t_58 += __pyx_bshape_0_D; + __pyx_t_58 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_58 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_59 < 0) { - __pyx_t_59 += __pyx_bshape_1_D; + __pyx_t_59 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_59 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_59 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_58, __pyx_bstride_0_D, __pyx_t_59, __pyx_bstride_1_D) = __pyx_v_res; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_59, __pyx_pybuffernd_D.diminfo[1].strides) = __pyx_v_res; /* "nipy/algorithms/statistics/intvol.pyx":628 * res += fcoords[l,ss] * fcoords[l,rr] @@ -7303,19 +7547,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_65 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_64 < 0) { - __pyx_t_64 += __pyx_bshape_0_D; + __pyx_t_64 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_64 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_65 < 0) { - __pyx_t_65 += __pyx_bshape_1_D; + __pyx_t_65 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_65 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_65 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_64, __pyx_bstride_0_D, __pyx_t_65, __pyx_bstride_1_D) = __pyx_v_res; - goto __pyx_L38; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_D.diminfo[1].strides) = __pyx_v_res; + goto __pyx_L35; } /*else*/ { @@ -7330,18 +7574,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_67 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_66 < 0) { - __pyx_t_66 += __pyx_bshape_0_D; + __pyx_t_66 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_66 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_67 < 0) { - __pyx_t_67 += __pyx_bshape_1_D; + __pyx_t_67 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_67 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_67 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_66, __pyx_bstride_0_D, __pyx_t_67, __pyx_bstride_1_D) = 0.0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_D.diminfo[1].strides) = 0.0; /* "nipy/algorithms/statistics/intvol.pyx":631 * else: @@ -7354,20 +7598,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_69 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_68 < 0) { - __pyx_t_68 += __pyx_bshape_0_D; + __pyx_t_68 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_68 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_69 < 0) { - __pyx_t_69 += __pyx_bshape_1_D; + __pyx_t_69 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_69 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_69 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_68, __pyx_bstride_0_D, __pyx_t_69, __pyx_bstride_1_D) = 0.0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_D.diminfo[1].strides) = 0.0; } - __pyx_L38:; + __pyx_L35:; } } @@ -7393,18 +7637,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_54 = 0; __pyx_t_8 = -1; if (__pyx_t_70 < 0) { - __pyx_t_70 += __pyx_bshape_0_d4; + __pyx_t_70 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_70 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_70 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_54 < 0) { - __pyx_t_54 += __pyx_bshape_1_d4; + __pyx_t_54 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_54 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_54 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_70, __pyx_bstride_0_d4, __pyx_t_54, __pyx_bstride_1_d4))); + __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_54, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":635 * for l in range(ds4): @@ -7417,18 +7661,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_72 = 4; __pyx_t_8 = -1; if (__pyx_t_71 < 0) { - __pyx_t_71 += __pyx_bshape_0_d4; + __pyx_t_71 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_71 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_71 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_72 < 0) { - __pyx_t_72 += __pyx_bshape_1_d4; + __pyx_t_72 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_72 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_72 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_72 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_71, __pyx_bstride_0_d4, __pyx_t_72, __pyx_bstride_1_d4)); + __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_d4.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":636 * v0 = pindex + d4[l,0] @@ -7440,14 +7684,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_73 = __pyx_v_v0; __pyx_t_8 = -1; if (__pyx_t_73 < 0) { - __pyx_t_73 += __pyx_bshape_0_fpmask; + __pyx_t_73 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_73 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_73 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_73 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_73, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":637 * w0 = d4[l,4] @@ -7469,18 +7713,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_75 = 1; __pyx_t_8 = -1; if (__pyx_t_74 < 0) { - __pyx_t_74 += __pyx_bshape_0_d4; + __pyx_t_74 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_74 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_74 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_74 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_75 < 0) { - __pyx_t_75 += __pyx_bshape_1_d4; + __pyx_t_75 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_75 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_75 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_75 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_74, __pyx_bstride_0_d4, __pyx_t_75, __pyx_bstride_1_d4))); + __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_75, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":639 * if m: @@ -7493,18 +7737,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_77 = 2; __pyx_t_8 = -1; if (__pyx_t_76 < 0) { - __pyx_t_76 += __pyx_bshape_0_d4; + __pyx_t_76 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_76 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_76 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_76 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_77 < 0) { - __pyx_t_77 += __pyx_bshape_1_d4; + __pyx_t_77 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_77 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_77 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_77 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v2 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_76, __pyx_bstride_0_d4, __pyx_t_77, __pyx_bstride_1_d4))); + __pyx_v_v2 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_76, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_77, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":640 * v1 = pindex + d4[l,1] @@ -7517,18 +7761,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_79 = 3; __pyx_t_8 = -1; if (__pyx_t_78 < 0) { - __pyx_t_78 += __pyx_bshape_0_d4; + __pyx_t_78 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_78 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_78 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_79 < 0) { - __pyx_t_79 += __pyx_bshape_1_d4; + __pyx_t_79 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_79 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_79 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v3 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_78, __pyx_bstride_0_d4, __pyx_t_79, __pyx_bstride_1_d4))); + __pyx_v_v3 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_d4.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":641 * v2 = pindex + d4[l,2] @@ -7541,18 +7785,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_81 = 5; __pyx_t_8 = -1; if (__pyx_t_80 < 0) { - __pyx_t_80 += __pyx_bshape_0_d4; + __pyx_t_80 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_80 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_80 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_81 < 0) { - __pyx_t_81 += __pyx_bshape_1_d4; + __pyx_t_81 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_81 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_81 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_80, __pyx_bstride_0_d4, __pyx_t_81, __pyx_bstride_1_d4)); + __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_d4.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":642 * v3 = pindex + d4[l,3] @@ -7565,18 +7809,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_83 = 6; __pyx_t_8 = -1; if (__pyx_t_82 < 0) { - __pyx_t_82 += __pyx_bshape_0_d4; + __pyx_t_82 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_82 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_82 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_83 < 0) { - __pyx_t_83 += __pyx_bshape_1_d4; + __pyx_t_83 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_83 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_83 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_82, __pyx_bstride_0_d4, __pyx_t_83, __pyx_bstride_1_d4)); + __pyx_v_w2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_83, __pyx_pybuffernd_d4.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":643 * w1 = d4[l,5] @@ -7589,18 +7833,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_85 = 7; __pyx_t_8 = -1; if (__pyx_t_84 < 0) { - __pyx_t_84 += __pyx_bshape_0_d4; + __pyx_t_84 += __pyx_pybuffernd_d4.diminfo[0].shape; if (unlikely(__pyx_t_84 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_84 >= __pyx_bshape_0_d4)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_d4.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_85 < 0) { - __pyx_t_85 += __pyx_bshape_1_d4; + __pyx_t_85 += __pyx_pybuffernd_d4.diminfo[1].shape; if (unlikely(__pyx_t_85 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_85 >= __pyx_bshape_1_d4)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_d4.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w3 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d4.buf, __pyx_t_84, __pyx_bstride_0_d4, __pyx_t_85, __pyx_bstride_1_d4)); + __pyx_v_w3 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d4.rcbuffer->pybuffer.buf, __pyx_t_84, __pyx_pybuffernd_d4.diminfo[0].strides, __pyx_t_85, __pyx_pybuffernd_d4.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":645 * w3 = d4[l,7] @@ -7612,9 +7856,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_86 = __pyx_v_v1; __pyx_t_8 = -1; if (__pyx_t_86 < 0) { - __pyx_t_86 += __pyx_bshape_0_fpmask; + __pyx_t_86 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_86 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_86 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7622,9 +7866,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_87 = __pyx_v_v2; __pyx_t_8 = -1; if (__pyx_t_87 < 0) { - __pyx_t_87 += __pyx_bshape_0_fpmask; + __pyx_t_87 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_87 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_87 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_87 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7632,14 +7876,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_88 = __pyx_v_v3; __pyx_t_8 = -1; if (__pyx_t_88 < 0) { - __pyx_t_88 += __pyx_bshape_0_fpmask; + __pyx_t_88 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_88 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_88 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_88 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_86, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_87, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_88, __pyx_bstride_0_fpmask))); + __pyx_v_m = (((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_86, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_88, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":647 * m = m * fpmask[v1] * fpmask[v2] * fpmask[v3] @@ -7652,13 +7896,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_90 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_89 < 0) { - __pyx_t_89 += __pyx_bshape_0_D; + __pyx_t_89 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_89 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_89 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_89 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_90 < 0) { - __pyx_t_90 += __pyx_bshape_1_D; + __pyx_t_90 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_90 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_90 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_90 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7667,13 +7911,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_92 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_91 < 0) { - __pyx_t_91 += __pyx_bshape_0_D; + __pyx_t_91 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_91 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_91 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_91 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_92 < 0) { - __pyx_t_92 += __pyx_bshape_1_D; + __pyx_t_92 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_92 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_92 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_92 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7682,13 +7926,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_94 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_93 < 0) { - __pyx_t_93 += __pyx_bshape_0_D; + __pyx_t_93 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_93 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_93 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_93 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_94 < 0) { - __pyx_t_94 += __pyx_bshape_1_D; + __pyx_t_94 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_94 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_94 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_94 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7705,13 +7949,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_96 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_95 < 0) { - __pyx_t_95 += __pyx_bshape_0_D; + __pyx_t_95 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_95 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_95 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_95 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_96 < 0) { - __pyx_t_96 += __pyx_bshape_1_D; + __pyx_t_96 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_96 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_96 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_96 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7720,13 +7964,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_98 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_97 < 0) { - __pyx_t_97 += __pyx_bshape_0_D; + __pyx_t_97 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_97 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_97 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_97 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_98 < 0) { - __pyx_t_98 += __pyx_bshape_1_D; + __pyx_t_98 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_98 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_98 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_98 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7735,13 +7979,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_100 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_99 < 0) { - __pyx_t_99 += __pyx_bshape_0_D; + __pyx_t_99 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_99 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_99 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_99 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_100 < 0) { - __pyx_t_100 += __pyx_bshape_1_D; + __pyx_t_100 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_100 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_100 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_100 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 648; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7758,13 +8002,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_102 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_101 < 0) { - __pyx_t_101 += __pyx_bshape_0_D; + __pyx_t_101 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_101 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_101 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_101 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_102 < 0) { - __pyx_t_102 += __pyx_bshape_1_D; + __pyx_t_102 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_102 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_102 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_102 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7773,13 +8017,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_104 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_103 < 0) { - __pyx_t_103 += __pyx_bshape_0_D; + __pyx_t_103 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_103 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_103 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_103 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_104 < 0) { - __pyx_t_104 += __pyx_bshape_1_D; + __pyx_t_104 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_104 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_104 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_104 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7788,13 +8032,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_106 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_105 < 0) { - __pyx_t_105 += __pyx_bshape_0_D; + __pyx_t_105 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_105 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_105 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_105 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_106 < 0) { - __pyx_t_106 += __pyx_bshape_1_D; + __pyx_t_106 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_106 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_106 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_106 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7811,18 +8055,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_108 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_107 < 0) { - __pyx_t_107 += __pyx_bshape_0_D; + __pyx_t_107 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_107 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_107 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_107 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_108 < 0) { - __pyx_t_108 += __pyx_bshape_1_D; + __pyx_t_108 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_108 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_108 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_108 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l3 = (__pyx_v_l3 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_89, __pyx_bstride_0_D, __pyx_t_90, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_91, __pyx_bstride_0_D, __pyx_t_92, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_93, __pyx_bstride_0_D, __pyx_t_94, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_95, __pyx_bstride_0_D, __pyx_t_96, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_97, __pyx_bstride_0_D, __pyx_t_98, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_99, __pyx_bstride_0_D, __pyx_t_100, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_101, __pyx_bstride_0_D, __pyx_t_102, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_103, __pyx_bstride_0_D, __pyx_t_104, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_105, __pyx_bstride_0_D, __pyx_t_106, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_107, __pyx_bstride_0_D, __pyx_t_108, __pyx_bstride_1_D)), 0))); + __pyx_v_l3 = (__pyx_v_l3 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu3_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_89, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_90, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_91, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_92, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_93, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_94, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_95, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_96, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_97, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_98, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_99, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_100, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_101, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_102, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_103, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_104, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_105, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_106, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_107, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_108, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":652 * D[w3,w3]) @@ -7835,13 +8079,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_110 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_109 < 0) { - __pyx_t_109 += __pyx_bshape_0_D; + __pyx_t_109 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_109 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_109 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_109 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_110 < 0) { - __pyx_t_110 += __pyx_bshape_1_D; + __pyx_t_110 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_110 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_110 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_110 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7850,13 +8094,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_112 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_111 < 0) { - __pyx_t_111 += __pyx_bshape_0_D; + __pyx_t_111 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_111 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_111 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_111 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_112 < 0) { - __pyx_t_112 += __pyx_bshape_1_D; + __pyx_t_112 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_112 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_112 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_112 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7865,13 +8109,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_114 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_113 < 0) { - __pyx_t_113 += __pyx_bshape_0_D; + __pyx_t_113 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_113 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_113 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_113 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_114 < 0) { - __pyx_t_114 += __pyx_bshape_1_D; + __pyx_t_114 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_114 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_114 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_114 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7888,13 +8132,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_116 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_115 < 0) { - __pyx_t_115 += __pyx_bshape_0_D; + __pyx_t_115 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_115 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_115 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_115 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_116 < 0) { - __pyx_t_116 += __pyx_bshape_1_D; + __pyx_t_116 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_116 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_116 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_116 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7903,13 +8147,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_118 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_117 < 0) { - __pyx_t_117 += __pyx_bshape_0_D; + __pyx_t_117 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_117 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_117 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_117 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_118 < 0) { - __pyx_t_118 += __pyx_bshape_1_D; + __pyx_t_118 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_118 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_118 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_118 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7918,13 +8162,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_120 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_119 < 0) { - __pyx_t_119 += __pyx_bshape_0_D; + __pyx_t_119 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_119 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_119 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_119 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_120 < 0) { - __pyx_t_120 += __pyx_bshape_1_D; + __pyx_t_120 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_120 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_120 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_120 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7941,13 +8185,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_122 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_121 < 0) { - __pyx_t_121 += __pyx_bshape_0_D; + __pyx_t_121 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_121 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_121 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_121 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_122 < 0) { - __pyx_t_122 += __pyx_bshape_1_D; + __pyx_t_122 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_122 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_122 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_122 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7956,13 +8200,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_124 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_123 < 0) { - __pyx_t_123 += __pyx_bshape_0_D; + __pyx_t_123 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_123 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_123 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_123 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_124 < 0) { - __pyx_t_124 += __pyx_bshape_1_D; + __pyx_t_124 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_124 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_124 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_124 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7971,13 +8215,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_126 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_125 < 0) { - __pyx_t_125 += __pyx_bshape_0_D; + __pyx_t_125 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_125 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_125 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_125 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_126 < 0) { - __pyx_t_126 += __pyx_bshape_1_D; + __pyx_t_126 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_126 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_126 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_126 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7994,18 +8238,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_128 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_127 < 0) { - __pyx_t_127 += __pyx_bshape_0_D; + __pyx_t_127 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_127 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_127 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_127 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_128 < 0) { - __pyx_t_128 += __pyx_bshape_1_D; + __pyx_t_128 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_128 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_128 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_128 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l2 = (__pyx_v_l2 - (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_109, __pyx_bstride_0_D, __pyx_t_110, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_111, __pyx_bstride_0_D, __pyx_t_112, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_113, __pyx_bstride_0_D, __pyx_t_114, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_115, __pyx_bstride_0_D, __pyx_t_116, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_117, __pyx_bstride_0_D, __pyx_t_118, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_119, __pyx_bstride_0_D, __pyx_t_120, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_121, __pyx_bstride_0_D, __pyx_t_122, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_123, __pyx_bstride_0_D, __pyx_t_124, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_125, __pyx_bstride_0_D, __pyx_t_126, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_127, __pyx_bstride_0_D, __pyx_t_128, __pyx_bstride_1_D)), 0))); + __pyx_v_l2 = (__pyx_v_l2 - (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_109, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_110, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_111, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_112, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_113, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_114, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_115, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_116, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_117, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_118, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_119, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_120, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_121, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_122, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_123, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_124, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_125, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_126, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_127, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_128, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":657 * D[w3,w3]) @@ -8018,13 +8262,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_130 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_129 < 0) { - __pyx_t_129 += __pyx_bshape_0_D; + __pyx_t_129 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_129 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_129 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_129 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_130 < 0) { - __pyx_t_130 += __pyx_bshape_1_D; + __pyx_t_130 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_130 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_130 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_130 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8033,13 +8277,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_132 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_131 < 0) { - __pyx_t_131 += __pyx_bshape_0_D; + __pyx_t_131 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_131 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_131 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_131 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_132 < 0) { - __pyx_t_132 += __pyx_bshape_1_D; + __pyx_t_132 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_132 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_132 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_132 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8048,13 +8292,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_134 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_133 < 0) { - __pyx_t_133 += __pyx_bshape_0_D; + __pyx_t_133 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_133 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_133 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_133 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_134 < 0) { - __pyx_t_134 += __pyx_bshape_1_D; + __pyx_t_134 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_134 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_134 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_134 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 657; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8071,13 +8315,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_136 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_135 < 0) { - __pyx_t_135 += __pyx_bshape_0_D; + __pyx_t_135 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_135 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_135 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_135 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_136 < 0) { - __pyx_t_136 += __pyx_bshape_1_D; + __pyx_t_136 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_136 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_136 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_136 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8086,13 +8330,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_138 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_137 < 0) { - __pyx_t_137 += __pyx_bshape_0_D; + __pyx_t_137 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_137 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_137 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_137 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_138 < 0) { - __pyx_t_138 += __pyx_bshape_1_D; + __pyx_t_138 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_138 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_138 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_138 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8101,13 +8345,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_140 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_139 < 0) { - __pyx_t_139 += __pyx_bshape_0_D; + __pyx_t_139 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_139 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_139 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_139 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_140 < 0) { - __pyx_t_140 += __pyx_bshape_1_D; + __pyx_t_140 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_140 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_140 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_140 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8124,13 +8368,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_142 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_141 < 0) { - __pyx_t_141 += __pyx_bshape_0_D; + __pyx_t_141 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_141 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_141 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_141 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_142 < 0) { - __pyx_t_142 += __pyx_bshape_1_D; + __pyx_t_142 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_142 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_142 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_142 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8139,13 +8383,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_144 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_143 < 0) { - __pyx_t_143 += __pyx_bshape_0_D; + __pyx_t_143 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_143 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_143 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_143 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_144 < 0) { - __pyx_t_144 += __pyx_bshape_1_D; + __pyx_t_144 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_144 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_144 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_144 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8154,13 +8398,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_146 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_145 < 0) { - __pyx_t_145 += __pyx_bshape_0_D; + __pyx_t_145 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_145 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_145 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_145 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_146 < 0) { - __pyx_t_146 += __pyx_bshape_1_D; + __pyx_t_146 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_146 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_146 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_146 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8177,18 +8421,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_148 = __pyx_v_w3; __pyx_t_8 = -1; if (__pyx_t_147 < 0) { - __pyx_t_147 += __pyx_bshape_0_D; + __pyx_t_147 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_147 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_147 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_147 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_148 < 0) { - __pyx_t_148 += __pyx_bshape_1_D; + __pyx_t_148 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_148 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_148 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_148 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l1 = (__pyx_v_l1 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_129, __pyx_bstride_0_D, __pyx_t_130, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_131, __pyx_bstride_0_D, __pyx_t_132, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_133, __pyx_bstride_0_D, __pyx_t_134, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_135, __pyx_bstride_0_D, __pyx_t_136, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_137, __pyx_bstride_0_D, __pyx_t_138, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_139, __pyx_bstride_0_D, __pyx_t_140, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_141, __pyx_bstride_0_D, __pyx_t_142, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_143, __pyx_bstride_0_D, __pyx_t_144, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_145, __pyx_bstride_0_D, __pyx_t_146, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_147, __pyx_bstride_0_D, __pyx_t_148, __pyx_bstride_1_D)), 0))); + __pyx_v_l1 = (__pyx_v_l1 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tet((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_129, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_130, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_131, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_132, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_133, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_134, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_135, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_136, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_137, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_138, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_139, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_140, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_141, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_142, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_143, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_144, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_145, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_146, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_147, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_148, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":662 * D[w3,w3]) @@ -8198,9 +8442,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje * for l in range(ds3): */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L43; + goto __pyx_L40; } - __pyx_L43:; + __pyx_L40:; } /* "nipy/algorithms/statistics/intvol.pyx":664 @@ -8225,18 +8469,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_150 = 0; __pyx_t_8 = -1; if (__pyx_t_149 < 0) { - __pyx_t_149 += __pyx_bshape_0_d3; + __pyx_t_149 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_149 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_149 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_149 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_150 < 0) { - __pyx_t_150 += __pyx_bshape_1_d3; + __pyx_t_150 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_150 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_150 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_150 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_149, __pyx_bstride_0_d3, __pyx_t_150, __pyx_bstride_1_d3))); + __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_149, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_150, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":666 * for l in range(ds3): @@ -8249,18 +8493,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_152 = 3; __pyx_t_8 = -1; if (__pyx_t_151 < 0) { - __pyx_t_151 += __pyx_bshape_0_d3; + __pyx_t_151 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_151 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_151 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_151 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_152 < 0) { - __pyx_t_152 += __pyx_bshape_1_d3; + __pyx_t_152 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_152 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_152 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_152 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_151, __pyx_bstride_0_d3, __pyx_t_152, __pyx_bstride_1_d3)); + __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_151, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_152, __pyx_pybuffernd_d3.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":667 * v0 = pindex + d3[l,0] @@ -8272,14 +8516,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_153 = __pyx_v_v0; __pyx_t_8 = -1; if (__pyx_t_153 < 0) { - __pyx_t_153 += __pyx_bshape_0_fpmask; + __pyx_t_153 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_153 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_153 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_153 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_153, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_153, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":668 * w0 = d3[l,3] @@ -8301,18 +8545,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_155 = 1; __pyx_t_8 = -1; if (__pyx_t_154 < 0) { - __pyx_t_154 += __pyx_bshape_0_d3; + __pyx_t_154 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_154 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_154 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_154 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_155 < 0) { - __pyx_t_155 += __pyx_bshape_1_d3; + __pyx_t_155 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_155 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_155 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_155 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_154, __pyx_bstride_0_d3, __pyx_t_155, __pyx_bstride_1_d3))); + __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_154, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_155, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":670 * if m: @@ -8325,18 +8569,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_157 = 2; __pyx_t_8 = -1; if (__pyx_t_156 < 0) { - __pyx_t_156 += __pyx_bshape_0_d3; + __pyx_t_156 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_156 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_156 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_156 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_157 < 0) { - __pyx_t_157 += __pyx_bshape_1_d3; + __pyx_t_157 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_157 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_157 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_157 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v2 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_156, __pyx_bstride_0_d3, __pyx_t_157, __pyx_bstride_1_d3))); + __pyx_v_v2 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_156, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_157, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":671 * v1 = pindex + d3[l,1] @@ -8349,18 +8593,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_159 = 4; __pyx_t_8 = -1; if (__pyx_t_158 < 0) { - __pyx_t_158 += __pyx_bshape_0_d3; + __pyx_t_158 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_158 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_158 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_158 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_159 < 0) { - __pyx_t_159 += __pyx_bshape_1_d3; + __pyx_t_159 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_159 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_159 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_159 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_158, __pyx_bstride_0_d3, __pyx_t_159, __pyx_bstride_1_d3)); + __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_158, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_159, __pyx_pybuffernd_d3.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":672 * v2 = pindex + d3[l,2] @@ -8373,18 +8617,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_161 = 5; __pyx_t_8 = -1; if (__pyx_t_160 < 0) { - __pyx_t_160 += __pyx_bshape_0_d3; + __pyx_t_160 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_160 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_160 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_160 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_161 < 0) { - __pyx_t_161 += __pyx_bshape_1_d3; + __pyx_t_161 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_161 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_161 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_161 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_160, __pyx_bstride_0_d3, __pyx_t_161, __pyx_bstride_1_d3)); + __pyx_v_w2 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_160, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_161, __pyx_pybuffernd_d3.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":674 * w2 = d3[l,5] @@ -8396,9 +8640,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_162 = __pyx_v_v1; __pyx_t_8 = -1; if (__pyx_t_162 < 0) { - __pyx_t_162 += __pyx_bshape_0_fpmask; + __pyx_t_162 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_162 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_162 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_162 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8406,14 +8650,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_163 = __pyx_v_v2; __pyx_t_8 = -1; if (__pyx_t_163 < 0) { - __pyx_t_163 += __pyx_bshape_0_fpmask; + __pyx_t_163 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_163 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_163 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_163 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_162, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_163, __pyx_bstride_0_fpmask))); + __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_162, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_163, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":675 * @@ -8426,13 +8670,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_165 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_164 < 0) { - __pyx_t_164 += __pyx_bshape_0_D; + __pyx_t_164 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_164 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_164 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_164 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_165 < 0) { - __pyx_t_165 += __pyx_bshape_1_D; + __pyx_t_165 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_165 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_165 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_165 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8441,13 +8685,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_167 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_166 < 0) { - __pyx_t_166 += __pyx_bshape_0_D; + __pyx_t_166 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_166 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_166 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_166 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_167 < 0) { - __pyx_t_167 += __pyx_bshape_1_D; + __pyx_t_167 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_167 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_167 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_167 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8456,13 +8700,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_169 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_168 < 0) { - __pyx_t_168 += __pyx_bshape_0_D; + __pyx_t_168 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_168 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_168 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_168 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_169 < 0) { - __pyx_t_169 += __pyx_bshape_1_D; + __pyx_t_169 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_169 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_169 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_169 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8479,13 +8723,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_171 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_170 < 0) { - __pyx_t_170 += __pyx_bshape_0_D; + __pyx_t_170 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_170 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_170 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_170 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_171 < 0) { - __pyx_t_171 += __pyx_bshape_1_D; + __pyx_t_171 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_171 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_171 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_171 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8494,13 +8738,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_173 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_172 < 0) { - __pyx_t_172 += __pyx_bshape_0_D; + __pyx_t_172 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_172 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_172 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_172 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_173 < 0) { - __pyx_t_173 += __pyx_bshape_1_D; + __pyx_t_173 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_173 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_173 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_173 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8509,18 +8753,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_175 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_174 < 0) { - __pyx_t_174 += __pyx_bshape_0_D; + __pyx_t_174 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_174 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_174 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_174 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_175 < 0) { - __pyx_t_175 += __pyx_bshape_1_D; + __pyx_t_175 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_175 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_175 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_175 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 676; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l2 = (__pyx_v_l2 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_164, __pyx_bstride_0_D, __pyx_t_165, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_166, __pyx_bstride_0_D, __pyx_t_167, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_168, __pyx_bstride_0_D, __pyx_t_169, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_170, __pyx_bstride_0_D, __pyx_t_171, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_172, __pyx_bstride_0_D, __pyx_t_173, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_174, __pyx_bstride_0_D, __pyx_t_175, __pyx_bstride_1_D)), 0))); + __pyx_v_l2 = (__pyx_v_l2 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu2_tri((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_164, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_165, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_166, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_167, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_168, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_169, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_170, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_171, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_172, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_173, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_174, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_175, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":678 * D[w1,w1], D[w1,w2], D[w2,w2]) @@ -8533,13 +8777,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_177 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_176 < 0) { - __pyx_t_176 += __pyx_bshape_0_D; + __pyx_t_176 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_176 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_176 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_176 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_177 < 0) { - __pyx_t_177 += __pyx_bshape_1_D; + __pyx_t_177 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_177 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_177 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_177 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8548,13 +8792,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_179 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_178 < 0) { - __pyx_t_178 += __pyx_bshape_0_D; + __pyx_t_178 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_178 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_178 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_178 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_179 < 0) { - __pyx_t_179 += __pyx_bshape_1_D; + __pyx_t_179 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_179 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_179 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_179 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8563,13 +8807,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_181 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_180 < 0) { - __pyx_t_180 += __pyx_bshape_0_D; + __pyx_t_180 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_180 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_180 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_180 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_181 < 0) { - __pyx_t_181 += __pyx_bshape_1_D; + __pyx_t_181 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_181 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_181 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_181 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8586,13 +8830,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_183 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_182 < 0) { - __pyx_t_182 += __pyx_bshape_0_D; + __pyx_t_182 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_182 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_182 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_182 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_183 < 0) { - __pyx_t_183 += __pyx_bshape_1_D; + __pyx_t_183 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_183 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_183 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_183 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8601,13 +8845,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_185 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_184 < 0) { - __pyx_t_184 += __pyx_bshape_0_D; + __pyx_t_184 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_184 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_184 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_184 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_185 < 0) { - __pyx_t_185 += __pyx_bshape_1_D; + __pyx_t_185 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_185 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_185 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_185 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8616,18 +8860,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_187 = __pyx_v_w2; __pyx_t_8 = -1; if (__pyx_t_186 < 0) { - __pyx_t_186 += __pyx_bshape_0_D; + __pyx_t_186 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_186 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_186 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_186 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_187 < 0) { - __pyx_t_187 += __pyx_bshape_1_D; + __pyx_t_187 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_187 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_187 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_187 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l1 = (__pyx_v_l1 - (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_176, __pyx_bstride_0_D, __pyx_t_177, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_178, __pyx_bstride_0_D, __pyx_t_179, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_180, __pyx_bstride_0_D, __pyx_t_181, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_182, __pyx_bstride_0_D, __pyx_t_183, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_184, __pyx_bstride_0_D, __pyx_t_185, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_186, __pyx_bstride_0_D, __pyx_t_187, __pyx_bstride_1_D)), 0))); + __pyx_v_l1 = (__pyx_v_l1 - (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_tri((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_176, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_177, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_178, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_179, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_180, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_181, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_182, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_183, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_184, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_185, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_186, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_187, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":681 * D[w1,w1], D[w1,w2], D[w2,w2]) @@ -8637,9 +8881,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje * for l in range(ds2): */ __pyx_v_l0 = (__pyx_v_l0 + __pyx_v_m); - goto __pyx_L46; + goto __pyx_L43; } - __pyx_L46:; + __pyx_L43:; } /* "nipy/algorithms/statistics/intvol.pyx":683 @@ -8664,18 +8908,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_189 = 0; __pyx_t_8 = -1; if (__pyx_t_188 < 0) { - __pyx_t_188 += __pyx_bshape_0_d2; + __pyx_t_188 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_188 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_188 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_188 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_189 < 0) { - __pyx_t_189 += __pyx_bshape_1_d2; + __pyx_t_189 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_189 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_189 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_189 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_188, __pyx_bstride_0_d2, __pyx_t_189, __pyx_bstride_1_d2))); + __pyx_v_v0 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_188, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_189, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":685 * for l in range(ds2): @@ -8688,18 +8932,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_191 = 2; __pyx_t_8 = -1; if (__pyx_t_190 < 0) { - __pyx_t_190 += __pyx_bshape_0_d2; + __pyx_t_190 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_190 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_190 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_190 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_191 < 0) { - __pyx_t_191 += __pyx_bshape_1_d2; + __pyx_t_191 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_191 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_191 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_191 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_190, __pyx_bstride_0_d2, __pyx_t_191, __pyx_bstride_1_d2)); + __pyx_v_w0 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_190, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_191, __pyx_pybuffernd_d2.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":686 * v0 = pindex + d2[l,0] @@ -8711,14 +8955,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_192 = __pyx_v_v0; __pyx_t_8 = -1; if (__pyx_t_192 < 0) { - __pyx_t_192 += __pyx_bshape_0_fpmask; + __pyx_t_192 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_192 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_192 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_192 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_192, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_192, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":687 * w0 = d2[l,2] @@ -8740,18 +8984,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_194 = 1; __pyx_t_8 = -1; if (__pyx_t_193 < 0) { - __pyx_t_193 += __pyx_bshape_0_d2; + __pyx_t_193 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_193 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_193 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_193 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_194 < 0) { - __pyx_t_194 += __pyx_bshape_1_d2; + __pyx_t_194 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_194 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_194 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_194 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_193, __pyx_bstride_0_d2, __pyx_t_194, __pyx_bstride_1_d2))); + __pyx_v_v1 = (__pyx_v_pindex + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_193, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_194, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":689 * if m: @@ -8764,18 +9008,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_196 = 3; __pyx_t_8 = -1; if (__pyx_t_195 < 0) { - __pyx_t_195 += __pyx_bshape_0_d2; + __pyx_t_195 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_195 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_195 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_195 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_196 < 0) { - __pyx_t_196 += __pyx_bshape_1_d2; + __pyx_t_196 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_196 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_196 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_196 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_195, __pyx_bstride_0_d2, __pyx_t_196, __pyx_bstride_1_d2)); + __pyx_v_w1 = (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_195, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_196, __pyx_pybuffernd_d2.diminfo[1].strides)); /* "nipy/algorithms/statistics/intvol.pyx":690 * v1 = pindex + d2[l,1] @@ -8787,14 +9031,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_197 = __pyx_v_v1; __pyx_t_8 = -1; if (__pyx_t_197 < 0) { - __pyx_t_197 += __pyx_bshape_0_fpmask; + __pyx_t_197 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_197 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_197 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_197 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_197, __pyx_bstride_0_fpmask))); + __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_197, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":691 * w1 = d2[l,3] @@ -8807,13 +9051,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_199 = __pyx_v_w0; __pyx_t_8 = -1; if (__pyx_t_198 < 0) { - __pyx_t_198 += __pyx_bshape_0_D; + __pyx_t_198 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_198 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_198 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_198 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_199 < 0) { - __pyx_t_199 += __pyx_bshape_1_D; + __pyx_t_199 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_199 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_199 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_199 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8822,13 +9066,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_201 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_200 < 0) { - __pyx_t_200 += __pyx_bshape_0_D; + __pyx_t_200 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_200 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_200 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_200 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_201 < 0) { - __pyx_t_201 += __pyx_bshape_1_D; + __pyx_t_201 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_201 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_201 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_201 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8837,18 +9081,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_203 = __pyx_v_w1; __pyx_t_8 = -1; if (__pyx_t_202 < 0) { - __pyx_t_202 += __pyx_bshape_0_D; + __pyx_t_202 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_202 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_202 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_202 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_203 < 0) { - __pyx_t_203 += __pyx_bshape_1_D; + __pyx_t_203 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_203 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_203 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_203 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_l1 = (__pyx_v_l1 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_198, __pyx_bstride_0_D, __pyx_t_199, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_200, __pyx_bstride_0_D, __pyx_t_201, __pyx_bstride_1_D)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_202, __pyx_bstride_0_D, __pyx_t_203, __pyx_bstride_1_D)), 0))); + __pyx_v_l1 = (__pyx_v_l1 + (__pyx_v_m * __pyx_f_4nipy_10algorithms_10statistics_6intvol_mu1_edge((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_198, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_199, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_200, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_201, __pyx_pybuffernd_D.diminfo[1].strides)), (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_202, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_203, __pyx_pybuffernd_D.diminfo[1].strides)), 0))); /* "nipy/algorithms/statistics/intvol.pyx":693 * l1 = l1 + m * mu1_edge(D[w0,w0], D[w0,w1], D[w1,w1]) @@ -8858,9 +9102,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje * l0 += mask.sum() */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L49; + goto __pyx_L46; } - __pyx_L49:; + __pyx_L46:; } } } @@ -8910,7 +9154,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_36 = PyFloat_FromDouble(__pyx_v_l3); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_36); __pyx_t_35 = PyList_New(4); if (unlikely(!__pyx_t_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_35)); + __Pyx_GOTREF(__pyx_t_35); PyList_SET_ITEM(__pyx_t_35, 0, __pyx_t_38); __Pyx_GIVEREF(__pyx_t_38); PyList_SET_ITEM(__pyx_t_35, 1, __pyx_t_5); @@ -8924,7 +9168,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __pyx_t_37 = 0; __pyx_t_36 = 0; __pyx_t_36 = PyTuple_New(1); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_36)); + __Pyx_GOTREF(__pyx_t_36); PyTuple_SET_ITEM(__pyx_t_36, 0, ((PyObject *)__pyx_t_35)); __Pyx_GIVEREF(((PyObject *)__pyx_t_35)); __pyx_t_35 = 0; @@ -8951,43 +9195,43 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje __Pyx_XDECREF(__pyx_t_38); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips3d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m4); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_m2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_m4.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_value); __Pyx_XDECREF((PyObject *)__pyx_v_coords_c); @@ -9021,40 +9265,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_8Lips3d(PyObje return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":699 - * - * - * def _convert_stride3(v, stride1, stride2): # <<<<<<<<<<<<<< - * """ - * Take a voxel, expressed as in index in stride1 and - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3 = {__Pyx_NAMESTR("_convert_stride3"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_19_convert_stride3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_18_convert_stride3[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_19_convert_stride3 = {__Pyx_NAMESTR("_convert_stride3"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_19_convert_stride3, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_18_convert_stride3)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_19_convert_stride3(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_v = 0; PyObject *__pyx_v_stride1 = 0; PyObject *__pyx_v_stride2 = 0; - PyObject *__pyx_v_v0 = NULL; - PyObject *__pyx_v_v1 = NULL; - PyObject *__pyx_v_v2 = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; - __Pyx_RefNannySetupContext("_convert_stride3"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_convert_stride3 (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -9062,26 +9290,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stri default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride3", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride3", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_convert_stride3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_convert_stride3") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -9102,6 +9327,32 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stri __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_18_convert_stride3(__pyx_self, __pyx_v_v, __pyx_v_stride1, __pyx_v_stride2); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":699 + * + * + * def _convert_stride3(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_18_convert_stride3(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2) { + PyObject *__pyx_v_v0 = NULL; + PyObject *__pyx_v_v1 = NULL; + PyObject *__pyx_v_v2 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_convert_stride3", 0); __Pyx_INCREF(__pyx_v_v); /* "nipy/algorithms/statistics/intvol.pyx":704 @@ -9224,39 +9475,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_9_convert_stri return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":711 - * - * - * def _convert_stride2(v, stride1, stride2): # <<<<<<<<<<<<<< - * """ - * Take a voxel, expressed as in index in stride1 and - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2 = {__Pyx_NAMESTR("_convert_stride2"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_21_convert_stride2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_20_convert_stride2[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_21_convert_stride2 = {__Pyx_NAMESTR("_convert_stride2"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_21_convert_stride2, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_20_convert_stride2)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_21_convert_stride2(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_v = 0; PyObject *__pyx_v_stride1 = 0; PyObject *__pyx_v_stride2 = 0; - PyObject *__pyx_v_v0 = NULL; - PyObject *__pyx_v_v1 = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; - __Pyx_RefNannySetupContext("_convert_stride2"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_convert_stride2 (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -9264,26 +9500,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_str default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride2", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride2", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_convert_stride2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_convert_stride2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -9304,6 +9537,31 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_str __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_20_convert_stride2(__pyx_self, __pyx_v_v, __pyx_v_stride1, __pyx_v_stride2); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":711 + * + * + * def _convert_stride2(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_20_convert_stride2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2) { + PyObject *__pyx_v_v0 = NULL; + PyObject *__pyx_v_v1 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_convert_stride2", 0); /* "nipy/algorithms/statistics/intvol.pyx":716 * re-express it as an index in stride2 @@ -9380,37 +9638,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_10_convert_str return __pyx_r; } -/* "nipy/algorithms/statistics/intvol.pyx":721 - * - * - * def _convert_stride1(v, stride1, stride2): # <<<<<<<<<<<<<< - * """ - * Take a voxel, expressed as in index in stride1 and - */ - -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1 = {__Pyx_NAMESTR("_convert_stride1"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_23_convert_stride1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_22_convert_stride1[] = "\n Take a voxel, expressed as in index in stride1 and\n re-express it as an index in stride2\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_23_convert_stride1 = {__Pyx_NAMESTR("_convert_stride1"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_23_convert_stride1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_22_convert_stride1)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_23_convert_stride1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_v = 0; PyObject *__pyx_v_stride1 = 0; PyObject *__pyx_v_stride2 = 0; - PyObject *__pyx_v_v0 = NULL; - PyObject *__pyx_r = NULL; + PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; - __Pyx_RefNannySetupContext("_convert_stride1"); - __pyx_self = __pyx_self; + __Pyx_RefNannySetupContext("_convert_stride1 (wrapper)", 0); { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__v,&__pyx_n_s__stride1,&__pyx_n_s__stride2,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -9418,26 +9663,23 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_str default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { + switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__v)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride1)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride1", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2); - if (likely(values[2])) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__stride2)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_convert_stride1", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_convert_stride1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_convert_stride1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -9458,6 +9700,29 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_str __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_22_convert_stride1(__pyx_self, __pyx_v_v, __pyx_v_stride1, __pyx_v_stride2); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/algorithms/statistics/intvol.pyx":721 + * + * + * def _convert_stride1(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_22_convert_stride1(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_v, PyObject *__pyx_v_stride1, PyObject *__pyx_v_stride2) { + PyObject *__pyx_v_v0 = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_convert_stride1", 0); /* "nipy/algorithms/statistics/intvol.pyx":726 * re-express it as an index in stride2 @@ -9505,6 +9770,64 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_str return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_25Lips2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_24Lips2d[] = " Estimate intrinsic volumes for 2d region in `mask` given `coords`\n\n Given a 2d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into triangles / edges /\n vertices, which are included based on whether all voxels in the triangle /\n edge / vertex are in the mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 2 (for 2\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,j), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1, mu2], being, respectively:\n #. Euler characteristic\n #. 2 * mean caliper diameter\n #. Area.\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_25Lips2d = {__Pyx_NAMESTR("Lips2d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_25Lips2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_24Lips2d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_25Lips2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_coords = 0; + PyObject *__pyx_v_mask = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Lips2d (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Lips2d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Lips2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_coords = values[0]; + __pyx_v_mask = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Lips2d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_24Lips2d(__pyx_self, __pyx_v_coords, __pyx_v_mask); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":730 * * @@ -9513,14 +9836,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_11_convert_str * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_12Lips2d[] = " Estimate intrinsic volumes for 2d region in `mask` given `coords`\n\n Given a 2d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into triangles / edges /\n vertices, which are included based on whether all voxels in the triangle /\n edge / vertex are in the mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 2 (for 2\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,j), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1, mu2], being, respectively:\n #. Euler characteristic\n #. 2 * mean caliper diameter\n #. Area.\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_12Lips2d = {__Pyx_NAMESTR("Lips2d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_12Lips2d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_coords = 0; - PyObject *__pyx_v_mask = 0; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_24Lips2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_coords, PyObject *__pyx_v_mask) { PyObject *__pyx_v_value = NULL; - PyArrayObject *__pyx_v_coords_c = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_coords_c = 0; PyArrayObject *__pyx_v_mask_c = 0; PyArrayObject *__pyx_v_fcoords = 0; PyArrayObject *__pyx_v_D = 0; @@ -9570,58 +9888,30 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj PyObject *__pyx_v_w1 = NULL; PyObject *__pyx_v_w2 = NULL; PyObject *__pyx_v_v = NULL; - Py_buffer __pyx_bstruct_mask_c; - Py_ssize_t __pyx_bstride_0_mask_c = 0; - Py_ssize_t __pyx_bstride_1_mask_c = 0; - Py_ssize_t __pyx_bshape_0_mask_c = 0; - Py_ssize_t __pyx_bshape_1_mask_c = 0; - Py_buffer __pyx_bstruct_fpmask; - Py_ssize_t __pyx_bstride_0_fpmask = 0; - Py_ssize_t __pyx_bshape_0_fpmask = 0; - Py_buffer __pyx_bstruct_d2; - Py_ssize_t __pyx_bstride_0_d2 = 0; - Py_ssize_t __pyx_bstride_1_d2 = 0; - Py_ssize_t __pyx_bshape_0_d2 = 0; - Py_ssize_t __pyx_bshape_1_d2 = 0; - Py_buffer __pyx_bstruct_d3; - Py_ssize_t __pyx_bstride_0_d3 = 0; - Py_ssize_t __pyx_bstride_1_d3 = 0; - Py_ssize_t __pyx_bshape_0_d3 = 0; - Py_ssize_t __pyx_bshape_1_d3 = 0; - Py_buffer __pyx_bstruct_cvertices; - Py_ssize_t __pyx_bstride_0_cvertices = 0; - Py_ssize_t __pyx_bshape_0_cvertices = 0; - Py_buffer __pyx_bstruct_coords_c; - Py_ssize_t __pyx_bstride_0_coords_c = 0; - Py_ssize_t __pyx_bstride_1_coords_c = 0; - Py_ssize_t __pyx_bstride_2_coords_c = 0; - Py_ssize_t __pyx_bshape_0_coords_c = 0; - Py_ssize_t __pyx_bshape_1_coords_c = 0; - Py_ssize_t __pyx_bshape_2_coords_c = 0; - Py_buffer __pyx_bstruct_fcoords; - Py_ssize_t __pyx_bstride_0_fcoords = 0; - Py_ssize_t __pyx_bstride_1_fcoords = 0; - Py_ssize_t __pyx_bshape_0_fcoords = 0; - Py_ssize_t __pyx_bshape_1_fcoords = 0; - Py_buffer __pyx_bstruct_pmask; - Py_ssize_t __pyx_bstride_0_pmask = 0; - Py_ssize_t __pyx_bstride_1_pmask = 0; - Py_ssize_t __pyx_bshape_0_pmask = 0; - Py_ssize_t __pyx_bshape_1_pmask = 0; - Py_buffer __pyx_bstruct_D; - Py_ssize_t __pyx_bstride_0_D = 0; - Py_ssize_t __pyx_bstride_1_D = 0; - Py_ssize_t __pyx_bshape_0_D = 0; - Py_ssize_t __pyx_bshape_1_D = 0; - Py_buffer __pyx_bstruct_dstrides; - Py_ssize_t __pyx_bstride_0_dstrides = 0; - Py_ssize_t __pyx_bshape_0_dstrides = 0; - Py_buffer __pyx_bstruct_strides; - Py_ssize_t __pyx_bstride_0_strides = 0; - Py_ssize_t __pyx_bshape_0_strides = 0; - Py_buffer __pyx_bstruct_fmask; - Py_ssize_t __pyx_bstride_0_fmask = 0; - Py_ssize_t __pyx_bshape_0_fmask = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_D; + __Pyx_Buffer __pyx_pybuffer_D; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coords_c; + __Pyx_Buffer __pyx_pybuffer_coords_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_cvertices; + __Pyx_Buffer __pyx_pybuffer_cvertices; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d3; + __Pyx_Buffer __pyx_pybuffer_d3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_dstrides; + __Pyx_Buffer __pyx_pybuffer_dstrides; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fcoords; + __Pyx_Buffer __pyx_pybuffer_fcoords; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fmask; + __Pyx_Buffer __pyx_pybuffer_fmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fpmask; + __Pyx_Buffer __pyx_pybuffer_fpmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask_c; + __Pyx_Buffer __pyx_pybuffer_mask_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_pmask; + __Pyx_Buffer __pyx_pybuffer_pmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_strides; + __Pyx_Buffer __pyx_pybuffer_strides; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9714,66 +10004,57 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; - __Pyx_RefNannySetupContext("Lips2d"); - __pyx_self = __pyx_self; - { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Lips2d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Lips2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coords = values[0]; - __pyx_v_mask = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Lips2d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips2d", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; + __Pyx_RefNannySetupContext("Lips2d", 0); __Pyx_INCREF(__pyx_v_coords); __Pyx_INCREF(__pyx_v_mask); - __pyx_bstruct_coords_c.buf = NULL; - __pyx_bstruct_mask_c.buf = NULL; - __pyx_bstruct_fcoords.buf = NULL; - __pyx_bstruct_D.buf = NULL; - __pyx_bstruct_fmask.buf = NULL; - __pyx_bstruct_fpmask.buf = NULL; - __pyx_bstruct_pmask.buf = NULL; - __pyx_bstruct_d3.buf = NULL; - __pyx_bstruct_d2.buf = NULL; - __pyx_bstruct_cvertices.buf = NULL; - __pyx_bstruct_strides.buf = NULL; - __pyx_bstruct_dstrides.buf = NULL; + __pyx_pybuffer_coords_c.pybuffer.buf = NULL; + __pyx_pybuffer_coords_c.refcount = 0; + __pyx_pybuffernd_coords_c.data = NULL; + __pyx_pybuffernd_coords_c.rcbuffer = &__pyx_pybuffer_coords_c; + __pyx_pybuffer_mask_c.pybuffer.buf = NULL; + __pyx_pybuffer_mask_c.refcount = 0; + __pyx_pybuffernd_mask_c.data = NULL; + __pyx_pybuffernd_mask_c.rcbuffer = &__pyx_pybuffer_mask_c; + __pyx_pybuffer_fcoords.pybuffer.buf = NULL; + __pyx_pybuffer_fcoords.refcount = 0; + __pyx_pybuffernd_fcoords.data = NULL; + __pyx_pybuffernd_fcoords.rcbuffer = &__pyx_pybuffer_fcoords; + __pyx_pybuffer_D.pybuffer.buf = NULL; + __pyx_pybuffer_D.refcount = 0; + __pyx_pybuffernd_D.data = NULL; + __pyx_pybuffernd_D.rcbuffer = &__pyx_pybuffer_D; + __pyx_pybuffer_fmask.pybuffer.buf = NULL; + __pyx_pybuffer_fmask.refcount = 0; + __pyx_pybuffernd_fmask.data = NULL; + __pyx_pybuffernd_fmask.rcbuffer = &__pyx_pybuffer_fmask; + __pyx_pybuffer_fpmask.pybuffer.buf = NULL; + __pyx_pybuffer_fpmask.refcount = 0; + __pyx_pybuffernd_fpmask.data = NULL; + __pyx_pybuffernd_fpmask.rcbuffer = &__pyx_pybuffer_fpmask; + __pyx_pybuffer_pmask.pybuffer.buf = NULL; + __pyx_pybuffer_pmask.refcount = 0; + __pyx_pybuffernd_pmask.data = NULL; + __pyx_pybuffernd_pmask.rcbuffer = &__pyx_pybuffer_pmask; + __pyx_pybuffer_d3.pybuffer.buf = NULL; + __pyx_pybuffer_d3.refcount = 0; + __pyx_pybuffernd_d3.data = NULL; + __pyx_pybuffernd_d3.rcbuffer = &__pyx_pybuffer_d3; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_cvertices.pybuffer.buf = NULL; + __pyx_pybuffer_cvertices.refcount = 0; + __pyx_pybuffernd_cvertices.data = NULL; + __pyx_pybuffernd_cvertices.rcbuffer = &__pyx_pybuffer_cvertices; + __pyx_pybuffer_strides.pybuffer.buf = NULL; + __pyx_pybuffer_strides.refcount = 0; + __pyx_pybuffernd_strides.data = NULL; + __pyx_pybuffernd_strides.rcbuffer = &__pyx_pybuffer_strides; + __pyx_pybuffer_dstrides.pybuffer.buf = NULL; + __pyx_pybuffer_dstrides.refcount = 0; + __pyx_pybuffernd_dstrides.data = NULL; + __pyx_pybuffernd_dstrides.rcbuffer = &__pyx_pybuffer_dstrides; /* "nipy/algorithms/statistics/intvol.pyx":765 * Journal of the American Statistical Association, 102(479):913-928. @@ -9789,8 +10070,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_3 = __Pyx_PySequence_GetSlice(__pyx_t_2, 1, PY_SSIZE_T_MAX); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9809,9 +10089,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":768 * raise ValueError('shape of mask does not match coordinates') @@ -9826,7 +10106,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -9847,8 +10127,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj */ __pyx_t_1 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__ndim); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -9887,7 +10166,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9898,7 +10177,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9920,7 +10199,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__Lips1d); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_coords); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_coords); __Pyx_GIVEREF(__pyx_v_coords); @@ -9931,7 +10210,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (unlikely(!__pyx_v_value)) { __Pyx_RaiseUnboundLocalError("value"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PySequence_SetSlice(__pyx_v_value, 0, 2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "nipy/algorithms/statistics/intvol.pyx":773 @@ -9945,9 +10224,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_INCREF(__pyx_v_value); __pyx_r = __pyx_v_value; goto __pyx_L0; - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; /* "nipy/algorithms/statistics/intvol.pyx":775 * return value @@ -9962,7 +10241,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -9971,7 +10250,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9982,7 +10261,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyList_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_5, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -9990,7 +10269,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj PyList_SET_ITEM(__pyx_t_5, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -10015,9 +10294,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + goto __pyx_L5; } - __pyx_L8:; + __pyx_L5:; /* "nipy/algorithms/statistics/intvol.pyx":803 * double res @@ -10030,19 +10309,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_7 = ((PyArrayObject *)__pyx_v_coords); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_coords_c, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coords_c, (PyObject*)__pyx_v_coords_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_coords_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_coords_c = __pyx_bstruct_coords_c.strides[0]; __pyx_bstride_1_coords_c = __pyx_bstruct_coords_c.strides[1]; __pyx_bstride_2_coords_c = __pyx_bstruct_coords_c.strides[2]; - __pyx_bshape_0_coords_c = __pyx_bstruct_coords_c.shape[0]; __pyx_bshape_1_coords_c = __pyx_bstruct_coords_c.shape[1]; __pyx_bshape_2_coords_c = __pyx_bstruct_coords_c.shape[2]; + __pyx_pybuffernd_coords_c.diminfo[0].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coords_c.diminfo[0].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coords_c.diminfo[1].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coords_c.diminfo[1].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_coords_c.diminfo[2].strides = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_coords_c.diminfo[2].shape = __pyx_pybuffernd_coords_c.rcbuffer->pybuffer.shape[2]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = 0; @@ -10060,19 +10338,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_12 = ((PyArrayObject *)__pyx_v_mask); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_mask_c = __pyx_bstruct_mask_c.strides[0]; __pyx_bstride_1_mask_c = __pyx_bstruct_mask_c.strides[1]; - __pyx_bshape_0_mask_c = __pyx_bstruct_mask_c.shape[0]; __pyx_bshape_1_mask_c = __pyx_bstruct_mask_c.shape[1]; + __pyx_pybuffernd_mask_c.diminfo[0].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask_c.diminfo[0].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask_c.diminfo[1].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask_c.diminfo[1].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = 0; @@ -10105,7 +10382,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_5 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; @@ -10137,7 +10414,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -10152,19 +10429,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_13 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_pmask, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_pmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_pmask = __pyx_bstruct_pmask.strides[0]; __pyx_bstride_1_pmask = __pyx_bstruct_pmask.strides[1]; - __pyx_bshape_0_pmask = __pyx_bstruct_pmask.shape[0]; __pyx_bshape_1_pmask = __pyx_bstruct_pmask.shape[1]; + __pyx_pybuffernd_pmask.diminfo[0].strides = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_pmask.diminfo[0].shape = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_pmask.diminfo[1].strides = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_pmask.diminfo[1].shape = __pyx_pybuffernd_pmask.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = 0; @@ -10208,19 +10484,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_16 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_fpmask = __pyx_bstruct_fpmask.strides[0]; - __pyx_bshape_0_fpmask = __pyx_bstruct_fpmask.shape[0]; + __pyx_pybuffernd_fpmask.diminfo[0].strides = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fpmask.diminfo[0].shape = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_16 = 0; @@ -10243,19 +10518,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_17 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fmask, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_17, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fmask, (PyObject*)__pyx_v_fmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_fmask = __pyx_bstruct_fmask.strides[0]; - __pyx_bshape_0_fmask = __pyx_bstruct_fmask.shape[0]; + __pyx_pybuffernd_fmask.diminfo[0].strides = __pyx_pybuffernd_fmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fmask.diminfo[0].shape = __pyx_pybuffernd_fmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; @@ -10277,7 +10551,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_neg_1); @@ -10285,7 +10559,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GIVEREF(__pyx_int_neg_1); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -10297,19 +10571,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_18 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fcoords, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer, (PyObject*)__pyx_t_18, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fcoords, (PyObject*)__pyx_v_fcoords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer, (PyObject*)__pyx_v_fcoords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_fcoords = __pyx_bstruct_fcoords.strides[0]; __pyx_bstride_1_fcoords = __pyx_bstruct_fcoords.strides[1]; - __pyx_bshape_0_fcoords = __pyx_bstruct_fcoords.shape[0]; __pyx_bshape_1_fcoords = __pyx_bstruct_fcoords.shape[1]; + __pyx_pybuffernd_fcoords.diminfo[0].strides = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fcoords.diminfo[0].shape = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_fcoords.diminfo[1].strides = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_fcoords.diminfo[1].shape = __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_18 = 0; @@ -10336,7 +10609,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -10348,7 +10621,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10361,7 +10634,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_19) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_t_19 = PyEval_CallObjectWithKeywords(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -10370,19 +10643,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_20 = ((PyArrayObject *)__pyx_t_19); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_t_20, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_strides = __pyx_bstruct_strides.strides[0]; - __pyx_bshape_0_strides = __pyx_bstruct_strides.shape[0]; + __pyx_pybuffernd_strides.diminfo[0].strides = __pyx_pybuffernd_strides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_strides.diminfo[0].shape = __pyx_pybuffernd_strides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_20 = 0; @@ -10411,7 +10683,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); @@ -10423,7 +10695,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10436,7 +10708,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -10445,19 +10717,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_21 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dstrides, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer, (PyObject*)__pyx_t_21, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dstrides, (PyObject*)__pyx_v_dstrides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer, (PyObject*)__pyx_v_dstrides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_dstrides = __pyx_bstruct_dstrides.strides[0]; - __pyx_bshape_0_dstrides = __pyx_bstruct_dstrides.shape[0]; + __pyx_pybuffernd_dstrides.diminfo[0].strides = __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dstrides.diminfo[0].shape = __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_21 = 0; @@ -10474,25 +10745,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_22 = 0; __pyx_t_8 = -1; if (__pyx_t_22 < 0) { - __pyx_t_22 += __pyx_bshape_0_strides; + __pyx_t_22 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_22 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_22 >= __pyx_bshape_0_strides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_22 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_22, __pyx_bstride_0_strides)); + __pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_t_24 = 1; __pyx_t_8 = -1; if (__pyx_t_24 < 0) { - __pyx_t_24 += __pyx_bshape_0_strides; + __pyx_t_24 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_24 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_24 >= __pyx_bshape_0_strides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_24 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_24, __pyx_bstride_0_strides)); + __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_v_ss0 = __pyx_t_23; __pyx_v_ss1 = __pyx_t_25; @@ -10506,25 +10777,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_26 = 0; __pyx_t_8 = -1; if (__pyx_t_26 < 0) { - __pyx_t_26 += __pyx_bshape_0_dstrides; + __pyx_t_26 += __pyx_pybuffernd_dstrides.diminfo[0].shape; if (unlikely(__pyx_t_26 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_26 >= __pyx_bshape_0_dstrides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_26 >= __pyx_pybuffernd_dstrides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_dstrides.buf, __pyx_t_26, __pyx_bstride_0_dstrides)); + __pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_dstrides.diminfo[0].strides)); __pyx_t_27 = 1; __pyx_t_8 = -1; if (__pyx_t_27 < 0) { - __pyx_t_27 += __pyx_bshape_0_dstrides; + __pyx_t_27 += __pyx_pybuffernd_dstrides.diminfo[0].shape; if (unlikely(__pyx_t_27 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_27 >= __pyx_bshape_0_dstrides)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_27 >= __pyx_pybuffernd_dstrides.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_dstrides.buf, __pyx_t_27, __pyx_bstride_0_dstrides)); + __pyx_t_23 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_dstrides.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_dstrides.diminfo[0].strides)); __pyx_v_ss0d = __pyx_t_25; __pyx_v_ss1d = __pyx_t_23; @@ -10536,7 +10807,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * for j in range(2): */ __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __pyx_v_verts = __pyx_t_3; __pyx_t_3 = 0; @@ -10567,9 +10838,6 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * cvertices = np.array(sorted(verts), np.intp) * */ - if (unlikely(((PyObject *)__pyx_v_verts) == Py_None)) { - PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } __pyx_t_3 = PyInt_FromLong(((__pyx_v_ss0d * __pyx_v_i) + (__pyx_v_ss1d * __pyx_v_j))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_28 = PyList_Append(__pyx_v_verts, __pyx_t_3); if (unlikely(__pyx_t_28 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -10590,7 +10858,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_verts)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_verts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_verts)); @@ -10603,7 +10871,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); @@ -10618,19 +10886,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_29 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_cvertices, (PyObject*)__pyx_t_29, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer, (PyObject*)__pyx_t_29, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_cvertices, (PyObject*)__pyx_v_cvertices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer, (PyObject*)__pyx_v_cvertices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_cvertices = __pyx_bstruct_cvertices.strides[0]; - __pyx_bshape_0_cvertices = __pyx_bstruct_cvertices.shape[0]; + __pyx_pybuffernd_cvertices.diminfo[0].strides = __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cvertices.diminfo[0].shape = __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_29 = 0; @@ -10649,7 +10916,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_48)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_48)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_48)); @@ -10671,7 +10938,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_49)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_49)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); @@ -10693,7 +10960,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_50)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_k_tuple_50)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_50)); @@ -10705,7 +10972,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_19); @@ -10735,7 +11002,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_30)); + __Pyx_GOTREF(__pyx_t_30); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_51)); PyTuple_SET_ITEM(__pyx_t_30, 0, ((PyObject *)__pyx_k_tuple_51)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); @@ -10769,7 +11036,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_union, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10778,7 +11045,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10786,7 +11053,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; __pyx_t_19 = PyTuple_New(1); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_GOTREF(__pyx_t_19); PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10817,7 +11084,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_union, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10826,7 +11093,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10834,7 +11101,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10858,7 +11125,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_19 = PyObject_GetAttr(__pyx_v_m3, __pyx_n_s__shape); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_30 = __Pyx_GetItemInt(__pyx_t_19, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -10869,7 +11136,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_31; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; __pyx_t_30 = PyList_New(0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_30)); + __Pyx_GOTREF(__pyx_t_30); __pyx_t_19 = __Pyx_GetItemInt(__pyx_v_m3, __pyx_v_i, sizeof(npy_intp), __Pyx_PyInt_to_py_Py_intptr_t); if (!__pyx_t_19) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); if (PyList_CheckExact(__pyx_t_19) || PyTuple_CheckExact(__pyx_t_19)) { @@ -10882,12 +11149,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj } __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_5)) { + if (!__pyx_t_33 && PyList_CheckExact(__pyx_t_5)) { if (__pyx_t_32 >= PyList_GET_SIZE(__pyx_t_5)) break; - __pyx_t_19 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_32); __Pyx_INCREF(__pyx_t_19); __pyx_t_32++; - } else if (PyTuple_CheckExact(__pyx_t_5)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_19 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_32); __Pyx_INCREF(__pyx_t_19); __pyx_t_32++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_19 = PySequence_ITEM(__pyx_t_5, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_33 && PyTuple_CheckExact(__pyx_t_5)) { if (__pyx_t_32 >= PyTuple_GET_SIZE(__pyx_t_5)) break; - __pyx_t_19 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_32); __Pyx_INCREF(__pyx_t_19); __pyx_t_32++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_19 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_32); __Pyx_INCREF(__pyx_t_19); __pyx_t_32++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_19 = PySequence_ITEM(__pyx_t_5, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_19 = __pyx_t_33(__pyx_t_5); if (unlikely(!__pyx_t_19)) { @@ -10905,7 +11180,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_19 = __Pyx_GetName(__pyx_m, __pyx_n_s___convert_stride2); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_19); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); @@ -10919,15 +11194,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_34); __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (unlikely(PyList_Append(__pyx_t_30, (PyObject*)__pyx_t_34))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_30, (PyObject*)__pyx_t_34))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_30))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_30))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; } __pyx_t_30 = PyTuple_New(1); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_30)); + __Pyx_GOTREF(__pyx_t_30); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_30, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -10940,19 +11215,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_35 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_35, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_35, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_35 = 0; @@ -10972,7 +11246,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_30); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_m3); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_m3); __Pyx_GIVEREF(__pyx_v_m3); @@ -10980,7 +11254,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_d3)); __Pyx_GIVEREF(((PyObject *)__pyx_v_d3)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -10992,19 +11266,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_35 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_35, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_35, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_35 = 0; @@ -11034,7 +11307,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __pyx_t_30 = PyObject_GetAttr(__pyx_v_m2, __pyx_n_s__shape); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_30); __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_30, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11045,7 +11318,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_31; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __pyx_t_30 = __Pyx_GetItemInt(__pyx_v_m2, __pyx_v_i, sizeof(npy_intp), __Pyx_PyInt_to_py_Py_intptr_t); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_30); if (PyList_CheckExact(__pyx_t_30) || PyTuple_CheckExact(__pyx_t_30)) { @@ -11058,12 +11331,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj } __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; for (;;) { - if (PyList_CheckExact(__pyx_t_34)) { + if (!__pyx_t_33 && PyList_CheckExact(__pyx_t_34)) { if (__pyx_t_32 >= PyList_GET_SIZE(__pyx_t_34)) break; - __pyx_t_30 = PyList_GET_ITEM(__pyx_t_34, __pyx_t_32); __Pyx_INCREF(__pyx_t_30); __pyx_t_32++; - } else if (PyTuple_CheckExact(__pyx_t_34)) { + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_30 = PyList_GET_ITEM(__pyx_t_34, __pyx_t_32); __Pyx_INCREF(__pyx_t_30); __pyx_t_32++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_30 = PySequence_ITEM(__pyx_t_34, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_33 && PyTuple_CheckExact(__pyx_t_34)) { if (__pyx_t_32 >= PyTuple_GET_SIZE(__pyx_t_34)) break; - __pyx_t_30 = PyTuple_GET_ITEM(__pyx_t_34, __pyx_t_32); __Pyx_INCREF(__pyx_t_30); __pyx_t_32++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_30 = PyTuple_GET_ITEM(__pyx_t_34, __pyx_t_32); __Pyx_INCREF(__pyx_t_30); __pyx_t_32++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_30 = PySequence_ITEM(__pyx_t_34, __pyx_t_32); __pyx_t_32++; if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { __pyx_t_30 = __pyx_t_33(__pyx_t_34); if (unlikely(!__pyx_t_30)) { @@ -11081,7 +11362,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_30 = __Pyx_GetName(__pyx_m, __pyx_n_s___convert_stride2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_30); __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_v); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_v); __Pyx_GIVEREF(__pyx_v_v); @@ -11095,15 +11376,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_19); __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (unlikely(PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_19))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_5, (PyObject*)__pyx_t_19))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; } __Pyx_DECREF(__pyx_t_34); __pyx_t_34 = 0; - if (unlikely(PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; } __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_t_1)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); @@ -11116,19 +11397,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_36 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_36 = 0; @@ -11148,7 +11428,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_m2); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_v_m2); __Pyx_GIVEREF(__pyx_v_m2); @@ -11156,7 +11436,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_d2)); __Pyx_GIVEREF(((PyObject *)__pyx_v_d2)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -11168,19 +11448,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_36 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_36, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_36 = 0; @@ -11216,19 +11495,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_37 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_D, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_t_37, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack); if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_D, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_D.rcbuffer->pybuffer, (PyObject*)__pyx_v_D, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } } - __pyx_bstride_0_D = __pyx_bstruct_D.strides[0]; __pyx_bstride_1_D = __pyx_bstruct_D.strides[1]; - __pyx_bshape_0_D = __pyx_bstruct_D.shape[0]; __pyx_bshape_1_D = __pyx_bstruct_D.shape[1]; + __pyx_pybuffernd_D.diminfo[0].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_D.diminfo[0].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_D.diminfo[1].strides = __pyx_pybuffernd_D.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_D.diminfo[1].shape = __pyx_pybuffernd_D.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_37 = 0; @@ -11312,14 +11590,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_40 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_40 < 0) { - __pyx_t_40 += __pyx_bshape_0_cvertices; + __pyx_t_40 += __pyx_pybuffernd_cvertices.diminfo[0].shape; if (unlikely(__pyx_t_40 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_40 >= __pyx_bshape_0_cvertices)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_cvertices.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_cvertices.buf, __pyx_t_40, __pyx_bstride_0_cvertices))); + __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_cvertices.diminfo[0].strides))); if (unlikely(__pyx_v_npix == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11336,14 +11614,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_41 = __pyx_v_rr; __pyx_t_8 = -1; if (__pyx_t_41 < 0) { - __pyx_t_41 += __pyx_bshape_0_fmask; + __pyx_t_41 += __pyx_pybuffernd_fmask.diminfo[0].shape; if (unlikely(__pyx_t_41 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_41 >= __pyx_bshape_0_fmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_fmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fmask.buf, __pyx_t_41, __pyx_bstride_0_fmask)); + __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fmask.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_fmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":863 * rr = (index+cvertices[r]) % npix @@ -11375,14 +11653,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_44 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_44 < 0) { - __pyx_t_44 += __pyx_bshape_0_cvertices; + __pyx_t_44 += __pyx_pybuffernd_cvertices.diminfo[0].shape; if (unlikely(__pyx_t_44 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_44 >= __pyx_bshape_0_cvertices)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_44 >= __pyx_pybuffernd_cvertices.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_cvertices.buf, __pyx_t_44, __pyx_bstride_0_cvertices))); + __pyx_t_8 = (__pyx_v_index + (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_cvertices.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_cvertices.diminfo[0].strides))); if (unlikely(__pyx_v_npix == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11399,14 +11677,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_45 = __pyx_v_ss; __pyx_t_8 = -1; if (__pyx_t_45 < 0) { - __pyx_t_45 += __pyx_bshape_0_fmask; + __pyx_t_45 += __pyx_pybuffernd_fmask.diminfo[0].shape; if (unlikely(__pyx_t_45 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_45 >= __pyx_bshape_0_fmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_45 >= __pyx_pybuffernd_fmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fmask.buf, __pyx_t_45, __pyx_bstride_0_fmask)); + __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fmask.rcbuffer->pybuffer.buf, __pyx_t_45, __pyx_pybuffernd_fmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":867 * ss = (index+cvertices[s]) % npix @@ -11440,13 +11718,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_49 = __pyx_v_ss; __pyx_t_8 = -1; if (__pyx_t_48 < 0) { - __pyx_t_48 += __pyx_bshape_0_fcoords; + __pyx_t_48 += __pyx_pybuffernd_fcoords.diminfo[0].shape; if (unlikely(__pyx_t_48 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_48 >= __pyx_bshape_0_fcoords)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_48 >= __pyx_pybuffernd_fcoords.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_49 < 0) { - __pyx_t_49 += __pyx_bshape_1_fcoords; + __pyx_t_49 += __pyx_pybuffernd_fcoords.diminfo[1].shape; if (unlikely(__pyx_t_49 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_49 >= __pyx_bshape_1_fcoords)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_49 >= __pyx_pybuffernd_fcoords.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11455,18 +11733,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_51 = __pyx_v_rr; __pyx_t_8 = -1; if (__pyx_t_50 < 0) { - __pyx_t_50 += __pyx_bshape_0_fcoords; + __pyx_t_50 += __pyx_pybuffernd_fcoords.diminfo[0].shape; if (unlikely(__pyx_t_50 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_50 >= __pyx_bshape_0_fcoords)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_50 >= __pyx_pybuffernd_fcoords.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_51 < 0) { - __pyx_t_51 += __pyx_bshape_1_fcoords; + __pyx_t_51 += __pyx_pybuffernd_fcoords.diminfo[1].shape; if (unlikely(__pyx_t_51 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_51 >= __pyx_bshape_1_fcoords)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_51 >= __pyx_pybuffernd_fcoords.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_fcoords.buf, __pyx_t_48, __pyx_bstride_0_fcoords, __pyx_t_49, __pyx_bstride_1_fcoords)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_fcoords.buf, __pyx_t_50, __pyx_bstride_0_fcoords, __pyx_t_51, __pyx_bstride_1_fcoords)))); + __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_fcoords.diminfo[0].strides, __pyx_t_49, __pyx_pybuffernd_fcoords.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_fcoords.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_fcoords.diminfo[0].strides, __pyx_t_51, __pyx_pybuffernd_fcoords.diminfo[1].strides)))); /* "nipy/algorithms/statistics/intvol.pyx":870 * for l in range(fcoords.shape[0]): @@ -11479,18 +11757,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_53 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_52 < 0) { - __pyx_t_52 += __pyx_bshape_0_D; + __pyx_t_52 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_52 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_52 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_52 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_53 < 0) { - __pyx_t_53 += __pyx_bshape_1_D; + __pyx_t_53 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_53 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_53 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_53 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_52, __pyx_bstride_0_D, __pyx_t_53, __pyx_bstride_1_D) = __pyx_v_res; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_D.diminfo[1].strides) = __pyx_v_res; /* "nipy/algorithms/statistics/intvol.pyx":871 * res += fcoords[l,ss] * fcoords[l,rr] @@ -11503,20 +11781,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_55 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_54 < 0) { - __pyx_t_54 += __pyx_bshape_0_D; + __pyx_t_54 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_54 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_54 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_54 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_55 < 0) { - __pyx_t_55 += __pyx_bshape_1_D; + __pyx_t_55 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_55 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_55 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_55 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_54, __pyx_bstride_0_D, __pyx_t_55, __pyx_bstride_1_D) = __pyx_v_res; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_55, __pyx_pybuffernd_D.diminfo[1].strides) = __pyx_v_res; } - goto __pyx_L29; + goto __pyx_L26; } /*else*/ { @@ -11531,18 +11809,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_47 = __pyx_v_s; __pyx_t_8 = -1; if (__pyx_t_46 < 0) { - __pyx_t_46 += __pyx_bshape_0_D; + __pyx_t_46 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_46 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_46 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_46 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_47 < 0) { - __pyx_t_47 += __pyx_bshape_1_D; + __pyx_t_47 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_47 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_47 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_47 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_46, __pyx_bstride_0_D, __pyx_t_47, __pyx_bstride_1_D) = 0.0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_47, __pyx_pybuffernd_D.diminfo[1].strides) = 0.0; /* "nipy/algorithms/statistics/intvol.pyx":874 * else: @@ -11555,20 +11833,20 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_57 = __pyx_v_r; __pyx_t_8 = -1; if (__pyx_t_56 < 0) { - __pyx_t_56 += __pyx_bshape_0_D; + __pyx_t_56 += __pyx_pybuffernd_D.diminfo[0].shape; if (unlikely(__pyx_t_56 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_56 >= __pyx_bshape_0_D)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_56 >= __pyx_pybuffernd_D.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_57 < 0) { - __pyx_t_57 += __pyx_bshape_1_D; + __pyx_t_57 += __pyx_pybuffernd_D.diminfo[1].shape; if (unlikely(__pyx_t_57 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_57 >= __pyx_bshape_1_D)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_57 >= __pyx_pybuffernd_D.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_D.buf, __pyx_t_56, __pyx_bstride_0_D, __pyx_t_57, __pyx_bstride_1_D) = 0.0; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_D.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_D.diminfo[0].strides, __pyx_t_57, __pyx_pybuffernd_D.diminfo[1].strides) = 0.0; } - __pyx_L29:; + __pyx_L26:; } } @@ -11594,18 +11872,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_42 = 0; __pyx_t_8 = -1; if (__pyx_t_58 < 0) { - __pyx_t_58 += __pyx_bshape_0_d3; + __pyx_t_58 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_58 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_58 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_58 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_42 < 0) { - __pyx_t_42 += __pyx_bshape_1_d3; + __pyx_t_42 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_42 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_42 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_42 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_58, __pyx_bstride_0_d3, __pyx_t_42, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_42, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_v_pindex, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 877; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -11625,18 +11903,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_60 = 3; __pyx_t_8 = -1; if (__pyx_t_59 < 0) { - __pyx_t_59 += __pyx_bshape_0_d3; + __pyx_t_59 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_59 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_59 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_59 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_60 < 0) { - __pyx_t_60 += __pyx_bshape_1_d3; + __pyx_t_60 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_60 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_60 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_60 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_59, __pyx_bstride_0_d3, __pyx_t_60, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_60, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 878; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_w0); __pyx_v_w0 = __pyx_t_2; @@ -11652,14 +11930,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_61 = __pyx_v_v0; __pyx_t_8 = -1; if (__pyx_t_61 < 0) { - __pyx_t_61 += __pyx_bshape_0_fpmask; + __pyx_t_61 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_61 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_61 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_61 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 879; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_61, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":880 * w0 = d3[l,3] @@ -11681,18 +11959,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_63 = 1; __pyx_t_8 = -1; if (__pyx_t_62 < 0) { - __pyx_t_62 += __pyx_bshape_0_d3; + __pyx_t_62 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_62 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_62 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_62 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_63 < 0) { - __pyx_t_63 += __pyx_bshape_1_d3; + __pyx_t_63 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_63 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_63 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_63 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_62, __pyx_bstride_0_d3, __pyx_t_63, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_63, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_Add(__pyx_v_pindex, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -11712,18 +11990,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_65 = 2; __pyx_t_8 = -1; if (__pyx_t_64 < 0) { - __pyx_t_64 += __pyx_bshape_0_d3; + __pyx_t_64 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_64 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_64 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_64 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_65 < 0) { - __pyx_t_65 += __pyx_bshape_1_d3; + __pyx_t_65 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_65 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_65 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_65 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_64, __pyx_bstride_0_d3, __pyx_t_65, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_v_pindex, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -11743,18 +12021,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_67 = 4; __pyx_t_8 = -1; if (__pyx_t_66 < 0) { - __pyx_t_66 += __pyx_bshape_0_d3; + __pyx_t_66 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_66 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_66 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_66 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_67 < 0) { - __pyx_t_67 += __pyx_bshape_1_d3; + __pyx_t_67 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_67 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_67 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_67 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_66, __pyx_bstride_0_d3, __pyx_t_67, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_67, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_w1); __pyx_v_w1 = __pyx_t_2; @@ -11771,18 +12049,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_69 = 5; __pyx_t_8 = -1; if (__pyx_t_68 < 0) { - __pyx_t_68 += __pyx_bshape_0_d3; + __pyx_t_68 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_68 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_68 >= __pyx_bshape_0_d3)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_68 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_69 < 0) { - __pyx_t_69 += __pyx_bshape_1_d3; + __pyx_t_69 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_69 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_69 >= __pyx_bshape_1_d3)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_69 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_68, __pyx_bstride_0_d3, __pyx_t_69, __pyx_bstride_1_d3))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_69, __pyx_pybuffernd_d3.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_w2); __pyx_v_w2 = __pyx_t_2; @@ -11798,9 +12076,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_70 = __pyx_v_v1; __pyx_t_8 = -1; if (__pyx_t_70 < 0) { - __pyx_t_70 += __pyx_bshape_0_fpmask; + __pyx_t_70 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_70 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_70 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_70 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11808,14 +12086,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_71 = __pyx_v_v2; __pyx_t_8 = -1; if (__pyx_t_71 < 0) { - __pyx_t_71 += __pyx_bshape_0_fpmask; + __pyx_t_71 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_71 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_71 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_71 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_70, __pyx_bstride_0_fpmask))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_71, __pyx_bstride_0_fpmask))); + __pyx_v_m = ((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_70, __pyx_pybuffernd_fpmask.diminfo[0].strides))) * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":886 * w2 = d3[l,5] @@ -11825,7 +12103,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * l1 = l1 - mu1_tri(D[w0,w0], D[w0,w1], D[w0,w2], */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11838,7 +12116,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_72 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_72 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11851,7 +12129,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_73 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_73 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11872,7 +12150,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * D[w1,w1], D[w1,w2], D[w2,w2]) * m */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w1); __Pyx_GIVEREF(__pyx_v_w1); @@ -11885,7 +12163,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_75 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_75 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w1); __Pyx_GIVEREF(__pyx_v_w1); @@ -11898,7 +12176,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_76 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_76 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w2); __Pyx_GIVEREF(__pyx_v_w2); @@ -11920,7 +12198,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * l0 = l0 + m */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11933,7 +12211,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_77 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_77 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11946,7 +12224,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_76 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_76 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -11967,7 +12245,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w1); __Pyx_GIVEREF(__pyx_v_w1); @@ -11980,7 +12258,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_74 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_74 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w1); __Pyx_GIVEREF(__pyx_v_w1); @@ -11993,7 +12271,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_73 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_73 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w2); __Pyx_GIVEREF(__pyx_v_w2); @@ -12015,9 +12293,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * for l in range(ds2): */ __pyx_v_l0 = (__pyx_v_l0 + __pyx_v_m); - goto __pyx_L34; + goto __pyx_L31; } - __pyx_L34:; + __pyx_L31:; } /* "nipy/algorithms/statistics/intvol.pyx":892 @@ -12042,18 +12320,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_79 = 0; __pyx_t_8 = -1; if (__pyx_t_78 < 0) { - __pyx_t_78 += __pyx_bshape_0_d2; + __pyx_t_78 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_78 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_78 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_78 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_79 < 0) { - __pyx_t_79 += __pyx_bshape_1_d2; + __pyx_t_79 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_79 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_79 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_79 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_78, __pyx_bstride_0_d2, __pyx_t_79, __pyx_bstride_1_d2))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_78, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_79, __pyx_pybuffernd_d2.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_Add(__pyx_v_pindex, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -12073,18 +12351,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_81 = 2; __pyx_t_8 = -1; if (__pyx_t_80 < 0) { - __pyx_t_80 += __pyx_bshape_0_d2; + __pyx_t_80 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_80 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_80 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_80 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_81 < 0) { - __pyx_t_81 += __pyx_bshape_1_d2; + __pyx_t_81 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_81 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_81 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_81 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_80, __pyx_bstride_0_d2, __pyx_t_81, __pyx_bstride_1_d2))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_80, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_81, __pyx_pybuffernd_d2.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_w0); __pyx_v_w0 = __pyx_t_1; @@ -12100,14 +12378,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_82 = __pyx_v_v0; __pyx_t_8 = -1; if (__pyx_t_82 < 0) { - __pyx_t_82 += __pyx_bshape_0_fpmask; + __pyx_t_82 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_82 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_82 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_82 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_82, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_82, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":896 * w0 = d2[l,2] @@ -12129,18 +12407,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_84 = 1; __pyx_t_8 = -1; if (__pyx_t_83 < 0) { - __pyx_t_83 += __pyx_bshape_0_d2; + __pyx_t_83 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_83 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_83 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_83 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_84 < 0) { - __pyx_t_84 += __pyx_bshape_1_d2; + __pyx_t_84 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_84 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_84 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_84 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_83, __pyx_bstride_0_d2, __pyx_t_84, __pyx_bstride_1_d2))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_83, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_84, __pyx_pybuffernd_d2.diminfo[1].strides))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyNumber_Add(__pyx_v_pindex, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -12160,18 +12438,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_86 = 3; __pyx_t_8 = -1; if (__pyx_t_85 < 0) { - __pyx_t_85 += __pyx_bshape_0_d2; + __pyx_t_85 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_85 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_85 >= __pyx_bshape_0_d2)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_85 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_8 = 0; if (__pyx_t_86 < 0) { - __pyx_t_86 += __pyx_bshape_1_d2; + __pyx_t_86 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_86 < 0)) __pyx_t_8 = 1; - } else if (unlikely(__pyx_t_86 >= __pyx_bshape_1_d2)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_86 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_8 = 1; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_85, __pyx_bstride_0_d2, __pyx_t_86, __pyx_bstride_1_d2))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_85, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_86, __pyx_pybuffernd_d2.diminfo[1].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_w1); __pyx_v_w1 = __pyx_t_2; @@ -12187,14 +12465,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_87 = __pyx_v_v1; __pyx_t_8 = -1; if (__pyx_t_87 < 0) { - __pyx_t_87 += __pyx_bshape_0_fpmask; + __pyx_t_87 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_87 < 0)) __pyx_t_8 = 0; - } else if (unlikely(__pyx_t_87 >= __pyx_bshape_0_fpmask)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_87 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_8 = 0; if (unlikely(__pyx_t_8 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_87, __pyx_bstride_0_fpmask))); + __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_87, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":900 * w1 = d2[l,3] @@ -12204,7 +12482,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * */ __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -12217,7 +12495,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_72 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_72 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_w0); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_w0); __Pyx_GIVEREF(__pyx_v_w0); @@ -12230,7 +12508,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_73 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_73 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_w1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_w1); __Pyx_GIVEREF(__pyx_v_w1); @@ -12252,9 +12530,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * l0 += mask.sum() */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L37; + goto __pyx_L34; } - __pyx_L37:; + __pyx_L34:; } } } @@ -12301,7 +12579,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_34 = PyFloat_FromDouble(__pyx_v_l2); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __pyx_t_19 = PyList_New(3); if (unlikely(!__pyx_t_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_19)); + __Pyx_GOTREF(__pyx_t_19); PyList_SET_ITEM(__pyx_t_19, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_19, 1, __pyx_t_1); @@ -12312,7 +12590,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __pyx_t_1 = 0; __pyx_t_34 = 0; __pyx_t_34 = PyTuple_New(1); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_34)); + __Pyx_GOTREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_34, 0, ((PyObject *)__pyx_t_19)); __Pyx_GIVEREF(((PyObject *)__pyx_t_19)); __pyx_t_19 = 0; @@ -12336,35 +12614,35 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj __Pyx_XDECREF(__pyx_t_34); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_cvertices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fcoords); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_pmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_D); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dstrides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fmask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_D.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cvertices.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dstrides.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fcoords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_pmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_value); __Pyx_XDECREF((PyObject *)__pyx_v_coords_c); @@ -12397,6 +12675,19 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_27EC2d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_26EC2d[] = " Compute Euler characteristic of 2D region in `mask`\n\n Given a 2d `mask`, compute the 0th intrinsic volume (Euler characteristic)\n of the masked region. The region is broken up into triangles / edges /\n vertices, which are included based on whether all voxels in the triangle /\n edge / vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,j), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_27EC2d = {__Pyx_NAMESTR("EC2d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_27EC2d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_26EC2d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_27EC2d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("EC2d (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_26EC2d(__pyx_self, ((PyObject *)__pyx_v_mask)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":907 * * @@ -12405,10 +12696,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_12Lips2d(PyObj * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_13EC2d[] = " Compute Euler characteristic of 2D region in `mask`\n\n Given a 2d `mask`, compute the 0th intrinsic volume (Euler characteristic)\n of the masked region. The region is broken up into triangles / edges /\n vertices, which are included based on whether all voxels in the triangle /\n edge / vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,j), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_13EC2d = {__Pyx_NAMESTR("EC2d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_13EC2d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_26EC2d(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_mask) { PyArrayObject *__pyx_v_mask_c = 0; PyArrayObject *__pyx_v_fpmask = 0; PyArrayObject *__pyx_v_d2 = 0; @@ -12433,27 +12721,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec PyObject *__pyx_v_union = NULL; PyObject *__pyx_v_c = NULL; PyObject *__pyx_v_v2 = NULL; - Py_buffer __pyx_bstruct_mask_c; - Py_ssize_t __pyx_bstride_0_mask_c = 0; - Py_ssize_t __pyx_bstride_1_mask_c = 0; - Py_ssize_t __pyx_bshape_0_mask_c = 0; - Py_ssize_t __pyx_bshape_1_mask_c = 0; - Py_buffer __pyx_bstruct_fpmask; - Py_ssize_t __pyx_bstride_0_fpmask = 0; - Py_ssize_t __pyx_bshape_0_fpmask = 0; - Py_buffer __pyx_bstruct_d2; - Py_ssize_t __pyx_bstride_0_d2 = 0; - Py_ssize_t __pyx_bstride_1_d2 = 0; - Py_ssize_t __pyx_bshape_0_d2 = 0; - Py_ssize_t __pyx_bshape_1_d2 = 0; - Py_buffer __pyx_bstruct_d3; - Py_ssize_t __pyx_bstride_0_d3 = 0; - Py_ssize_t __pyx_bstride_1_d3 = 0; - Py_ssize_t __pyx_bshape_0_d3 = 0; - Py_ssize_t __pyx_bshape_1_d3 = 0; - Py_buffer __pyx_bstruct_strides; - Py_ssize_t __pyx_bstride_0_strides = 0; - Py_ssize_t __pyx_bshape_0_strides = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d2; + __Pyx_Buffer __pyx_pybuffer_d2; + __Pyx_LocalBuf_ND __pyx_pybuffernd_d3; + __Pyx_Buffer __pyx_pybuffer_d3; + __Pyx_LocalBuf_ND __pyx_pybuffernd_fpmask; + __Pyx_Buffer __pyx_pybuffer_fpmask; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask_c; + __Pyx_Buffer __pyx_pybuffer_mask_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_strides; + __Pyx_Buffer __pyx_pybuffer_strides; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -12500,13 +12777,27 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("EC2d"); - __pyx_self = __pyx_self; - __pyx_bstruct_mask_c.buf = NULL; - __pyx_bstruct_fpmask.buf = NULL; - __pyx_bstruct_d2.buf = NULL; - __pyx_bstruct_d3.buf = NULL; - __pyx_bstruct_strides.buf = NULL; + __Pyx_RefNannySetupContext("EC2d", 0); + __pyx_pybuffer_mask_c.pybuffer.buf = NULL; + __pyx_pybuffer_mask_c.refcount = 0; + __pyx_pybuffernd_mask_c.data = NULL; + __pyx_pybuffernd_mask_c.rcbuffer = &__pyx_pybuffer_mask_c; + __pyx_pybuffer_fpmask.pybuffer.buf = NULL; + __pyx_pybuffer_fpmask.refcount = 0; + __pyx_pybuffernd_fpmask.data = NULL; + __pyx_pybuffernd_fpmask.rcbuffer = &__pyx_pybuffer_fpmask; + __pyx_pybuffer_d2.pybuffer.buf = NULL; + __pyx_pybuffer_d2.refcount = 0; + __pyx_pybuffernd_d2.data = NULL; + __pyx_pybuffernd_d2.rcbuffer = &__pyx_pybuffer_d2; + __pyx_pybuffer_d3.pybuffer.buf = NULL; + __pyx_pybuffer_d3.refcount = 0; + __pyx_pybuffernd_d3.data = NULL; + __pyx_pybuffernd_d3.rcbuffer = &__pyx_pybuffer_d3; + __pyx_pybuffer_strides.pybuffer.buf = NULL; + __pyx_pybuffer_strides.refcount = 0; + __pyx_pybuffernd_strides.data = NULL; + __pyx_pybuffernd_strides.rcbuffer = &__pyx_pybuffer_strides; /* "nipy/algorithms/statistics/intvol.pyx":936 * Journal of the American Statistical Association, 102(479):913-928. @@ -12521,7 +12812,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_mask); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mask); __Pyx_GIVEREF(__pyx_v_mask); @@ -12530,7 +12821,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12541,7 +12832,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -12549,7 +12840,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 936; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -12574,9 +12865,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":952 * np.npy_intp ss0, ss1 # strides @@ -12598,19 +12889,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_6 = ((PyArrayObject *)__pyx_v_mask); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask_c, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask_c, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_mask_c = __pyx_bstruct_mask_c.strides[0]; __pyx_bstride_1_mask_c = __pyx_bstruct_mask_c.strides[1]; - __pyx_bshape_0_mask_c = __pyx_bstruct_mask_c.shape[0]; __pyx_bshape_1_mask_c = __pyx_bstruct_mask_c.shape[1]; + __pyx_pybuffernd_mask_c.diminfo[0].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask_c.diminfo[0].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask_c.diminfo[1].strides = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask_c.diminfo[1].shape = __pyx_pybuffernd_mask_c.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; @@ -12632,7 +12922,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_3 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -12664,7 +12954,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -12727,19 +13017,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_13 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_fpmask, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer, (PyObject*)__pyx_v_fpmask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_fpmask = __pyx_bstruct_fpmask.strides[0]; - __pyx_bshape_0_fpmask = __pyx_bstruct_fpmask.shape[0]; + __pyx_pybuffernd_fpmask.diminfo[0].strides = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_fpmask.diminfo[0].shape = __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = 0; @@ -12766,7 +13055,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_pmask_shape); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_pmask_shape); __Pyx_GIVEREF(__pyx_v_pmask_shape); @@ -12778,7 +13067,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_14); __pyx_t_14 = 0; @@ -12791,7 +13080,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (PyDict_SetItem(__pyx_t_14, ((PyObject *)__pyx_n_s__dtype), __pyx_t_15) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - __pyx_t_15 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), ((PyObject *)__pyx_t_14)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -12800,19 +13089,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_16 = ((PyArrayObject *)__pyx_t_15); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_strides, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_strides.rcbuffer->pybuffer, (PyObject*)__pyx_v_strides, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_strides = __pyx_bstruct_strides.strides[0]; - __pyx_bshape_0_strides = __pyx_bstruct_strides.shape[0]; + __pyx_pybuffernd_strides.diminfo[0].strides = __pyx_pybuffernd_strides.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_strides.diminfo[0].shape = __pyx_pybuffernd_strides.rcbuffer->pybuffer.shape[0]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 966; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_16 = 0; @@ -12829,25 +13117,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_17 = 0; __pyx_t_7 = -1; if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_0_strides; + __pyx_t_17 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_17 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_0_strides)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_17, __pyx_bstride_0_strides)); + __pyx_t_18 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_t_19 = 1; __pyx_t_7 = -1; if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_0_strides; + __pyx_t_19 += __pyx_pybuffernd_strides.diminfo[0].shape; if (unlikely(__pyx_t_19 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_0_strides)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_strides.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 967; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_strides.buf, __pyx_t_19, __pyx_bstride_0_strides)); + __pyx_t_20 = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_strides.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_strides.diminfo[0].strides)); __pyx_v_ss0 = __pyx_t_18; __pyx_v_ss1 = __pyx_t_20; @@ -12863,7 +13151,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_61)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_61)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); @@ -12885,7 +13173,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_14)); + __Pyx_GOTREF(__pyx_t_14); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_62)); PyTuple_SET_ITEM(__pyx_t_14, 0, ((PyObject *)__pyx_k_tuple_62)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_62)); @@ -12907,7 +13195,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_14 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_63)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_k_tuple_63)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); @@ -12919,7 +13207,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); @@ -12949,7 +13237,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_21 = PyTuple_New(2); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_21)); + __Pyx_GOTREF(__pyx_t_21); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_64)); PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)__pyx_k_tuple_64)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_64)); @@ -12983,7 +13271,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_union, 3, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -12992,7 +13280,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -13000,7 +13288,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -13012,19 +13300,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_22 = ((PyArrayObject *)__pyx_t_15); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_t_22, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_10, &__pyx_t_9, &__pyx_t_8); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d3, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d3.rcbuffer->pybuffer, (PyObject*)__pyx_v_d3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_8); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_10, __pyx_t_9, __pyx_t_8); } } - __pyx_bstride_0_d3 = __pyx_bstruct_d3.strides[0]; __pyx_bstride_1_d3 = __pyx_bstruct_d3.strides[1]; - __pyx_bshape_0_d3 = __pyx_bstruct_d3.shape[0]; __pyx_bshape_1_d3 = __pyx_bstruct_d3.shape[1]; + __pyx_pybuffernd_d3.diminfo[0].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d3.diminfo[0].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d3.diminfo[1].strides = __pyx_pybuffernd_d3.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d3.diminfo[1].shape = __pyx_pybuffernd_d3.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_22 = 0; @@ -13051,7 +13338,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_15 = __Pyx_GetItemInt(__pyx_v_union, 2, sizeof(long), PyInt_FromLong); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -13060,7 +13347,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -13068,7 +13355,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_15); __pyx_t_15 = 0; @@ -13080,19 +13367,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_23 = ((PyArrayObject *)__pyx_t_15); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __pyx_t_7 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_t_23, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); if (unlikely(__pyx_t_7 < 0)) { PyErr_Fetch(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_d2, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_d2.rcbuffer->pybuffer, (PyObject*)__pyx_v_d2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_8); Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); __Pyx_RaiseBufferFallbackError(); } else { PyErr_Restore(__pyx_t_8, __pyx_t_9, __pyx_t_10); } } - __pyx_bstride_0_d2 = __pyx_bstruct_d2.strides[0]; __pyx_bstride_1_d2 = __pyx_bstruct_d2.strides[1]; - __pyx_bshape_0_d2 = __pyx_bstruct_d2.shape[0]; __pyx_bshape_1_d2 = __pyx_bstruct_d2.shape[1]; + __pyx_pybuffernd_d2.diminfo[0].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_d2.diminfo[0].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_d2.diminfo[1].strides = __pyx_pybuffernd_d2.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_d2.diminfo[1].shape = __pyx_pybuffernd_d2.rcbuffer->pybuffer.shape[1]; if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_23 = 0; @@ -13170,18 +13456,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_29 = 0; __pyx_t_7 = -1; if (__pyx_t_28 < 0) { - __pyx_t_28 += __pyx_bshape_0_d3; + __pyx_t_28 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_28 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_28 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_28 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_29 < 0) { - __pyx_t_29 += __pyx_bshape_1_d3; + __pyx_t_29 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_29 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_29 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_29 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 987; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_28, __pyx_bstride_0_d3, __pyx_t_29, __pyx_bstride_1_d3))); + __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":988 * for l in range(ds3): @@ -13193,14 +13479,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_30 = __pyx_v_v0; __pyx_t_7 = -1; if (__pyx_t_30 < 0) { - __pyx_t_30 += __pyx_bshape_0_fpmask; + __pyx_t_30 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_30 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_30 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_30 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 988; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_30, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":989 * v0 = index + d3[l,0] @@ -13227,18 +13513,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_32 = 1; __pyx_t_7 = -1; if (__pyx_t_31 < 0) { - __pyx_t_31 += __pyx_bshape_0_d3; + __pyx_t_31 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_31 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_31 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_31 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_32 < 0) { - __pyx_t_32 += __pyx_bshape_1_d3; + __pyx_t_32 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_32 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_32 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_32 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_31, __pyx_bstride_0_d3, __pyx_t_32, __pyx_bstride_1_d3))); + __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_d3.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":991 * if m and v0: @@ -13251,18 +13537,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_34 = 2; __pyx_t_7 = -1; if (__pyx_t_33 < 0) { - __pyx_t_33 += __pyx_bshape_0_d3; + __pyx_t_33 += __pyx_pybuffernd_d3.diminfo[0].shape; if (unlikely(__pyx_t_33 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_33 >= __pyx_bshape_0_d3)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_33 >= __pyx_pybuffernd_d3.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_34 < 0) { - __pyx_t_34 += __pyx_bshape_1_d3; + __pyx_t_34 += __pyx_pybuffernd_d3.diminfo[1].shape; if (unlikely(__pyx_t_34 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_34 >= __pyx_bshape_1_d3)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_34 >= __pyx_pybuffernd_d3.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_15 = PyInt_FromLong((__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d3.buf, __pyx_t_33, __pyx_bstride_0_d3, __pyx_t_34, __pyx_bstride_1_d3)))); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong((__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d3.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_d3.diminfo[0].strides, __pyx_t_34, __pyx_pybuffernd_d3.diminfo[1].strides)))); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_XDECREF(__pyx_v_v2); __pyx_v_v2 = __pyx_t_15; @@ -13278,14 +13564,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_35 = __pyx_v_v1; __pyx_t_7 = -1; if (__pyx_t_35 < 0) { - __pyx_t_35 += __pyx_bshape_0_fpmask; + __pyx_t_35 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_35 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_35 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_35 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_15 = PyInt_FromLong((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_35, __pyx_bstride_0_fpmask)))); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyInt_FromLong((__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_fpmask.diminfo[0].strides)))); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_fpmask), __pyx_v_v2); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -13305,9 +13591,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec * for l in range(ds2): */ __pyx_v_l0 = (__pyx_v_l0 + __pyx_v_m); - goto __pyx_L12; + goto __pyx_L10; } - __pyx_L12:; + __pyx_L10:; } /* "nipy/algorithms/statistics/intvol.pyx":995 @@ -13332,18 +13618,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_37 = 0; __pyx_t_7 = -1; if (__pyx_t_36 < 0) { - __pyx_t_36 += __pyx_bshape_0_d2; + __pyx_t_36 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_36 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_36 >= __pyx_bshape_0_d2)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_36 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_37 < 0) { - __pyx_t_37 += __pyx_bshape_1_d2; + __pyx_t_37 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_37 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_37 >= __pyx_bshape_1_d2)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_37 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_36, __pyx_bstride_0_d2, __pyx_t_37, __pyx_bstride_1_d2))); + __pyx_v_v0 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_37, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":997 * for l in range(ds2): @@ -13355,14 +13641,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_38 = __pyx_v_v0; __pyx_t_7 = -1; if (__pyx_t_38 < 0) { - __pyx_t_38 += __pyx_bshape_0_fpmask; + __pyx_t_38 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_38 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_38 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_38 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_38, __pyx_bstride_0_fpmask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_fpmask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":998 * v0 = index + d2[l,0] @@ -13384,18 +13670,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_40 = 1; __pyx_t_7 = -1; if (__pyx_t_39 < 0) { - __pyx_t_39 += __pyx_bshape_0_d2; + __pyx_t_39 += __pyx_pybuffernd_d2.diminfo[0].shape; if (unlikely(__pyx_t_39 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_39 >= __pyx_bshape_0_d2)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_39 >= __pyx_pybuffernd_d2.diminfo[0].shape)) __pyx_t_7 = 0; if (__pyx_t_40 < 0) { - __pyx_t_40 += __pyx_bshape_1_d2; + __pyx_t_40 += __pyx_pybuffernd_d2.diminfo[1].shape; if (unlikely(__pyx_t_40 < 0)) __pyx_t_7 = 1; - } else if (unlikely(__pyx_t_40 >= __pyx_bshape_1_d2)) __pyx_t_7 = 1; + } else if (unlikely(__pyx_t_40 >= __pyx_pybuffernd_d2.diminfo[1].shape)) __pyx_t_7 = 1; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 999; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_d2.buf, __pyx_t_39, __pyx_bstride_0_d2, __pyx_t_40, __pyx_bstride_1_d2))); + __pyx_v_v1 = (__pyx_v_index + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_d2.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_d2.diminfo[0].strides, __pyx_t_40, __pyx_pybuffernd_d2.diminfo[1].strides))); /* "nipy/algorithms/statistics/intvol.pyx":1000 * if m: @@ -13407,14 +13693,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __pyx_t_41 = __pyx_v_v1; __pyx_t_7 = -1; if (__pyx_t_41 < 0) { - __pyx_t_41 += __pyx_bshape_0_fpmask; + __pyx_t_41 += __pyx_pybuffernd_fpmask.diminfo[0].shape; if (unlikely(__pyx_t_41 < 0)) __pyx_t_7 = 0; - } else if (unlikely(__pyx_t_41 >= __pyx_bshape_0_fpmask)) __pyx_t_7 = 0; + } else if (unlikely(__pyx_t_41 >= __pyx_pybuffernd_fpmask.diminfo[0].shape)) __pyx_t_7 = 0; if (unlikely(__pyx_t_7 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1000; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_fpmask.buf, __pyx_t_41, __pyx_bstride_0_fpmask))); + __pyx_v_m = (__pyx_v_m * (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_fpmask.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_fpmask.diminfo[0].strides))); /* "nipy/algorithms/statistics/intvol.pyx":1001 * v1 = index + d2[l,1] @@ -13424,9 +13710,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec * l0 += mask.sum() */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L15; + goto __pyx_L13; } - __pyx_L15:; + __pyx_L13:; } } } @@ -13478,21 +13764,21 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec __Pyx_XDECREF(__pyx_t_21); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.EC2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask_c); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_fpmask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_d3); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_strides); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d2.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_d3.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_fpmask.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_strides.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_mask_c); __Pyx_XDECREF((PyObject *)__pyx_v_fpmask); @@ -13509,6 +13795,70 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_29Lips1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_28Lips1d[] = " Estimate intrinsic volumes for 1D region in `mask` given `coords`\n\n Given a 1d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into edges / vertices, which\n are included based on whether all voxels in the edge / vertex are in the\n mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 1 (for 1\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1], being, respectively:\n #. Euler characteristic\n #. Line segment length\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_29Lips1d = {__Pyx_NAMESTR("Lips1d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_29Lips1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_28Lips1d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_29Lips1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_coords = 0; + PyArrayObject *__pyx_v_mask = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("Lips1d (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("Lips1d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Lips1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_coords = ((PyArrayObject *)values[0]); + __pyx_v_mask = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("Lips1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coords), __pyx_ptype_5numpy_ndarray, 1, "coords", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_28Lips1d(__pyx_self, __pyx_v_coords, __pyx_v_mask); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":1007 * * @@ -13517,12 +13867,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_13EC2d(PyObjec * """ Estimate intrinsic volumes for 1D region in `mask` given `coords` */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_14Lips1d[] = " Estimate intrinsic volumes for 1D region in `mask` given `coords`\n\n Given a 1d `mask` and coordinates `coords`, estimate the intrinsic volumes\n of the masked region. The region is broken up into edges / vertices, which\n are included based on whether all voxels in the edge / vertex are in the\n mask or not.\n\n Parameters\n ----------\n coords : ndarray((N,i,j,k))\n Coordinates for the voxels in the mask. ``N`` will often be 1 (for 1\n dimensional coordinates, but can be any integer > 0\n mask : ndarray((i,), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu : ndarray\n Array of intrinsic volumes [mu0, mu1], being, respectively:\n #. Euler characteristic\n #. Line segment length\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_14Lips1d = {__Pyx_NAMESTR("Lips1d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_14Lips1d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_coords = 0; - PyArrayObject *__pyx_v_mask = 0; +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_28Lips1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_coords, PyArrayObject *__pyx_v_mask) { npy_intp __pyx_v_i; npy_intp __pyx_v_l; npy_intp __pyx_v_r; @@ -13537,14 +13882,10 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj double __pyx_v_l1; double __pyx_v_res; PyObject *__pyx_v_D = NULL; - Py_buffer __pyx_bstruct_mask; - Py_ssize_t __pyx_bstride_0_mask = 0; - Py_ssize_t __pyx_bshape_0_mask = 0; - Py_buffer __pyx_bstruct_coords; - Py_ssize_t __pyx_bstride_0_coords = 0; - Py_ssize_t __pyx_bstride_1_coords = 0; - Py_ssize_t __pyx_bshape_0_coords = 0; - Py_ssize_t __pyx_bshape_1_coords = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_coords; + __Pyx_Buffer __pyx_pybuffer_coords; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask; + __Pyx_Buffer __pyx_pybuffer_mask; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -13574,68 +13915,25 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__coords,&__pyx_n_s__mask,0}; - __Pyx_RefNannySetupContext("Lips1d"); - __pyx_self = __pyx_self; - { - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__coords); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mask); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("Lips1d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "Lips1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_coords = ((PyArrayObject *)values[0]); - __pyx_v_mask = ((PyArrayObject *)values[1]); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("Lips1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips1d", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_bstruct_coords.buf = NULL; - __pyx_bstruct_mask.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_coords), __pyx_ptype_5numpy_ndarray, 1, "coords", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("Lips1d", 0); + __pyx_pybuffer_coords.pybuffer.buf = NULL; + __pyx_pybuffer_coords.refcount = 0; + __pyx_pybuffernd_coords.data = NULL; + __pyx_pybuffernd_coords.rcbuffer = &__pyx_pybuffer_coords; + __pyx_pybuffer_mask.pybuffer.buf = NULL; + __pyx_pybuffer_mask.refcount = 0; + __pyx_pybuffernd_mask.data = NULL; + __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_coords, (PyObject*)__pyx_v_coords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_coords.rcbuffer->pybuffer, (PyObject*)__pyx_v_coords, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_coords = __pyx_bstruct_coords.strides[0]; __pyx_bstride_1_coords = __pyx_bstruct_coords.strides[1]; - __pyx_bshape_0_coords = __pyx_bstruct_coords.shape[0]; __pyx_bshape_1_coords = __pyx_bstruct_coords.shape[1]; + __pyx_pybuffernd_coords.diminfo[0].strides = __pyx_pybuffernd_coords.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_coords.diminfo[0].shape = __pyx_pybuffernd_coords.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_coords.diminfo[1].strides = __pyx_pybuffernd_coords.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_coords.diminfo[1].shape = __pyx_pybuffernd_coords.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; - __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; + __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; /* "nipy/algorithms/statistics/intvol.pyx":1042 * Journal of the American Statistical Association, 102(479):913-928. @@ -13659,9 +13957,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + goto __pyx_L3; } - __pyx_L6:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":1044 * if mask.shape[0] != coords.shape[1]: @@ -13676,7 +13974,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_mask)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mask)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); @@ -13685,7 +13983,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; @@ -13696,7 +13994,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyList_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -13704,7 +14002,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj PyList_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1044; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -13729,9 +14027,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + goto __pyx_L4; } - __pyx_L7:; + __pyx_L4:; /* "nipy/algorithms/statistics/intvol.pyx":1052 * double res @@ -13815,14 +14113,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_10 = __pyx_v_rr; __pyx_t_9 = -1; if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_mask; + __pyx_t_10 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_10 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_10 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_10, __pyx_bstride_0_mask)); + __pyx_v_mr = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_mask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":1060 * rr = (i+r) % s0 @@ -13868,14 +14166,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_13 = __pyx_v_ss; __pyx_t_9 = -1; if (__pyx_t_13 < 0) { - __pyx_t_13 += __pyx_bshape_0_mask; + __pyx_t_13 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_13 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_13 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_13, __pyx_bstride_0_mask)); + __pyx_v_ms = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_mask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":1064 * ss = (i+s) % s0 @@ -13909,13 +14207,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_17 = __pyx_v_ss; __pyx_t_9 = -1; if (__pyx_t_16 < 0) { - __pyx_t_16 += __pyx_bshape_0_coords; + __pyx_t_16 += __pyx_pybuffernd_coords.diminfo[0].shape; if (unlikely(__pyx_t_16 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_coords)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_pybuffernd_coords.diminfo[0].shape)) __pyx_t_9 = 0; if (__pyx_t_17 < 0) { - __pyx_t_17 += __pyx_bshape_1_coords; + __pyx_t_17 += __pyx_pybuffernd_coords.diminfo[1].shape; if (unlikely(__pyx_t_17 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_coords)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_17 >= __pyx_pybuffernd_coords.diminfo[1].shape)) __pyx_t_9 = 1; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -13924,18 +14222,18 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_19 = __pyx_v_rr; __pyx_t_9 = -1; if (__pyx_t_18 < 0) { - __pyx_t_18 += __pyx_bshape_0_coords; + __pyx_t_18 += __pyx_pybuffernd_coords.diminfo[0].shape; if (unlikely(__pyx_t_18 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_coords)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_pybuffernd_coords.diminfo[0].shape)) __pyx_t_9 = 0; if (__pyx_t_19 < 0) { - __pyx_t_19 += __pyx_bshape_1_coords; + __pyx_t_19 += __pyx_pybuffernd_coords.diminfo[1].shape; if (unlikely(__pyx_t_19 < 0)) __pyx_t_9 = 1; - } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_coords)) __pyx_t_9 = 1; + } else if (unlikely(__pyx_t_19 >= __pyx_pybuffernd_coords.diminfo[1].shape)) __pyx_t_9 = 1; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_coords.buf, __pyx_t_16, __pyx_bstride_0_coords, __pyx_t_17, __pyx_bstride_1_coords)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_coords.buf, __pyx_t_18, __pyx_bstride_0_coords, __pyx_t_19, __pyx_bstride_1_coords)))); + __pyx_v_res = (__pyx_v_res + ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_coords.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_coords.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_coords.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_coords.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_coords.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_coords.diminfo[1].strides)))); /* "nipy/algorithms/statistics/intvol.pyx":1067 * for l in range(coords.shape[0]): @@ -13951,7 +14249,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_s); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_GOTREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_2); @@ -13976,7 +14274,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_2 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_r); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_20); __Pyx_GIVEREF(__pyx_t_20); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); @@ -13987,7 +14285,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - goto __pyx_L14; + goto __pyx_L11; } /*else*/ { @@ -14003,7 +14301,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_s); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); @@ -14025,7 +14323,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_3 = __Pyx_PyInt_to_py_Py_intptr_t(__pyx_v_r); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); @@ -14035,7 +14333,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj if (PyObject_SetItem(__pyx_v_D, ((PyObject *)__pyx_t_4), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; } - __pyx_L14:; + __pyx_L11:; } } @@ -14049,14 +14347,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_8 = __pyx_v_i; __pyx_t_9 = -1; if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_mask; + __pyx_t_8 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_8, __pyx_bstride_0_mask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_mask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":1074 * @@ -14082,14 +14380,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_21 = __Pyx_mod_long(__pyx_t_11, __pyx_v_s0); __pyx_t_9 = -1; if (__pyx_t_21 < 0) { - __pyx_t_21 += __pyx_bshape_0_mask; + __pyx_t_21 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_21 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_21 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_21 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_21, __pyx_bstride_0_mask)) * ((__pyx_v_i + 1) < __pyx_v_s0))); + __pyx_v_m = (__pyx_v_m * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_mask.diminfo[0].strides)) * ((__pyx_v_i + 1) < __pyx_v_s0))); /* "nipy/algorithms/statistics/intvol.pyx":1076 * if m: @@ -14120,9 +14418,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj * l0 += mask.sum() */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L17; + goto __pyx_L14; } - __pyx_L17:; + __pyx_L14:; } /* "nipy/algorithms/statistics/intvol.pyx":1079 @@ -14165,7 +14463,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_4 = PyFloat_FromDouble(__pyx_v_l1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_20 = PyList_New(2); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_20)); + __Pyx_GOTREF(__pyx_t_20); PyList_SET_ITEM(__pyx_t_20, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_20, 1, __pyx_t_4); @@ -14173,7 +14471,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_20)); __Pyx_GIVEREF(((PyObject *)__pyx_t_20)); __pyx_t_20 = 0; @@ -14194,15 +14492,15 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj __Pyx_XDECREF(__pyx_t_20); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.Lips1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_coords); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_coords.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_D); __Pyx_XGIVEREF(__pyx_r); @@ -14210,6 +14508,24 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_31EC1d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ +static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_30EC1d[] = " Compute Euler characteristic for 1d `mask`\n\n Given a 1d mask `mask`, compute the 0th intrinsic volume (Euler\n characteristic) of the masked region. The region is broken up into edges /\n vertices, which are included based on whether all voxels in the edge /\n vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; +static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_31EC1d = {__Pyx_NAMESTR("EC1d"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_31EC1d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_30EC1d)}; +static PyObject *__pyx_pw_4nipy_10algorithms_10statistics_6intvol_31EC1d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("EC1d (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_10algorithms_10statistics_6intvol_30EC1d(__pyx_self, ((PyArrayObject *)__pyx_v_mask)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "nipy/algorithms/statistics/intvol.pyx":1083 * * @@ -14218,17 +14534,13 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_14Lips1d(PyObj * */ -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/ -static char __pyx_doc_4nipy_10algorithms_10statistics_6intvol_15EC1d[] = " Compute Euler characteristic for 1d `mask`\n\n Given a 1d mask `mask`, compute the 0th intrinsic volume (Euler\n characteristic) of the masked region. The region is broken up into edges /\n vertices, which are included based on whether all voxels in the edge /\n vertex are in the mask or not.\n\n Parameters\n ----------\n mask : ndarray((i,), np.int)\n Binary mask determining whether or not a voxel is in the mask.\n\n Returns\n -------\n mu0 : int\n Euler characteristic\n\n Notes\n -----\n The array mask is assumed to be binary. At the time of writing, it\n is not clear how to get cython to use np.bool arrays.\n\n The 3d cubes are triangulated into 6 tetrahedra of equal volume, as\n described in the reference below.\n\n References\n ----------\n Taylor, J.E. & Worsley, K.J. (2007). \"Detecting sparse signal in random fields,\n with an application to brain mapping.\"\n Journal of the American Statistical Association, 102(479):913-928.\n "; -static PyMethodDef __pyx_mdef_4nipy_10algorithms_10statistics_6intvol_15EC1d = {__Pyx_NAMESTR("EC1d"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_15EC1d)}; -static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObject *__pyx_self, PyObject *__pyx_v_mask) { +static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_30EC1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask) { npy_intp __pyx_v_i; npy_intp __pyx_v_m; npy_intp __pyx_v_s0; double __pyx_v_l0; - Py_buffer __pyx_bstruct_mask; - Py_ssize_t __pyx_bstride_0_mask = 0; - Py_ssize_t __pyx_bshape_0_mask = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_mask; + __Pyx_Buffer __pyx_pybuffer_mask; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -14246,16 +14558,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("EC1d"); - __pyx_self = __pyx_self; - __pyx_bstruct_mask.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannySetupContext("EC1d", 0); + __pyx_pybuffer_mask.pybuffer.buf = NULL; + __pyx_pybuffer_mask.refcount = 0; + __pyx_pybuffernd_mask.data = NULL; + __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_mask, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_intp_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_mask = __pyx_bstruct_mask.strides[0]; - __pyx_bshape_0_mask = __pyx_bstruct_mask.shape[0]; + __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; /* "nipy/algorithms/statistics/intvol.pyx":1115 * Journal of the American Statistical Association, 102(479):913-928. @@ -14270,16 +14582,16 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_v_mask); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_mask); - __Pyx_GIVEREF(__pyx_v_mask); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_mask)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_mask)); __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; @@ -14290,7 +14602,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -14298,7 +14610,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec PyList_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -14323,9 +14635,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; /* "nipy/algorithms/statistics/intvol.pyx":1120 * cdef: @@ -14343,7 +14655,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec * for i in range(s0): * m = mask[i] */ - __pyx_v_s0 = (((PyArrayObject *)__pyx_v_mask)->dimensions[0]); + __pyx_v_s0 = (__pyx_v_mask->dimensions[0]); /* "nipy/algorithms/statistics/intvol.pyx":1123 * @@ -14366,14 +14678,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __pyx_t_8 = __pyx_v_i; __pyx_t_9 = -1; if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_mask; + __pyx_t_8 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_8 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_8 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_8, __pyx_bstride_0_mask)); + __pyx_v_m = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_mask.diminfo[0].strides)); /* "nipy/algorithms/statistics/intvol.pyx":1125 * for i in range(s0): @@ -14399,14 +14711,14 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __pyx_t_11 = __Pyx_mod_long(__pyx_t_10, __pyx_v_s0); __pyx_t_9 = -1; if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_0_mask; + __pyx_t_11 += __pyx_pybuffernd_mask.diminfo[0].shape; if (unlikely(__pyx_t_11 < 0)) __pyx_t_9 = 0; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_0_mask)) __pyx_t_9 = 0; + } else if (unlikely(__pyx_t_11 >= __pyx_pybuffernd_mask.diminfo[0].shape)) __pyx_t_9 = 0; if (unlikely(__pyx_t_9 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_v_m = (__pyx_v_m * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_bstruct_mask.buf, __pyx_t_11, __pyx_bstride_0_mask)) * ((__pyx_v_i + 1) < __pyx_v_s0))); + __pyx_v_m = (__pyx_v_m * ((*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_intp_t *, __pyx_pybuffernd_mask.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_mask.diminfo[0].strides)) * ((__pyx_v_i + 1) < __pyx_v_s0))); /* "nipy/algorithms/statistics/intvol.pyx":1127 * if m: @@ -14416,9 +14728,9 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec * l0 += mask.sum() */ __pyx_v_l0 = (__pyx_v_l0 - __pyx_v_m); - goto __pyx_L8; + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; } /* "nipy/algorithms/statistics/intvol.pyx":1129 @@ -14429,7 +14741,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec */ __pyx_t_3 = PyFloat_FromDouble(__pyx_v_l0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_mask, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_mask), __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -14462,20 +14774,31 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec __Pyx_XDECREF(__pyx_t_3); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} __Pyx_AddTraceback("nipy.algorithms.statistics.intvol.EC1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_mask); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "numpy.pxd":190 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -14483,8 +14806,7 @@ static PyObject *__pyx_pf_4nipy_10algorithms_10statistics_6intvol_15EC1d(PyObjec * # requirements, and does not yet fullfill the PEP. */ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -14509,13 +14831,13 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__", 0); if (__pyx_v_info != NULL) { __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":196 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -14526,11 +14848,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":199 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -14539,7 +14861,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":200 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -14548,16 +14870,16 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":202 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":204 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -14567,7 +14889,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":205 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -14575,11 +14897,11 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L6; + goto __pyx_L4; } /*else*/ { - /* "numpy.pxd":207 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -14588,9 +14910,9 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_copy_shape = 0; } - __pyx_L6:; + __pyx_L4:; - /* "numpy.pxd":209 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -14600,37 +14922,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":210 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_74), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L7:; + __pyx_L5:; - /* "numpy.pxd":213 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -14640,46 +14962,46 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_76), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L8:; + __pyx_L6:; - /* "numpy.pxd":217 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":218 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -14688,7 +15010,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":219 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -14697,7 +15019,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":222 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -14706,7 +15028,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":223 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -14715,7 +15037,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":224 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -14726,49 +15048,49 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":225 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":226 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L9; + goto __pyx_L7; } /*else*/ { - /* "numpy.pxd":228 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":229 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L9:; + __pyx_L7:; - /* "numpy.pxd":230 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -14777,25 +15099,25 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":231 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":232 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":235 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -14804,17 +15126,19 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_f = NULL; - /* "numpy.pxd":236 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":240 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -14823,7 +15147,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":242 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -14839,7 +15163,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":244 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -14851,49 +15175,50 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L12; + goto __pyx_L10; } /*else*/ { - /* "numpy.pxd":247 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L12:; + __pyx_L10:; - /* "numpy.pxd":249 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":250 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":251 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -14904,10 +15229,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (!__pyx_t_2) { - /* "numpy.pxd":252 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -14924,24 +15249,24 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ } if (__pyx_t_1) { - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_78), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L14; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L14:; + __pyx_L12:; - /* "numpy.pxd":254 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -14950,10 +15275,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":255 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -14963,10 +15288,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":256 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -14976,10 +15301,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":257 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -14989,10 +15314,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -15002,10 +15327,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -15015,10 +15340,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -15028,10 +15353,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -15041,10 +15366,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -15054,10 +15379,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -15067,10 +15392,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -15080,10 +15405,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -15093,10 +15418,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -15106,10 +15431,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -15119,10 +15444,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -15132,10 +15457,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -15145,10 +15470,10 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L15; + goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -15158,37 +15483,37 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L15; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":272 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_79), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_79), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L15:; + __pyx_L13:; - /* "numpy.pxd":273 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -15197,7 +15522,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":274 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -15206,57 +15531,57 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L13; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":276 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":277 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":278 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":281 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":282 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L13:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; @@ -15281,31 +15606,39 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ return __pyx_r; } -/* "numpy.pxd":284 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":285 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":286 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -15313,11 +15646,11 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "numpy.pxd":287 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -15327,7 +15660,7 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":288 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -15335,14 +15668,14 @@ static CYTHON_UNUSED void __pyx_pf_5numpy_7ndarray_1__releasebuffer__(PyObject * * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":764 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -15357,9 +15690,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":765 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -15367,7 +15700,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15385,7 +15718,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":767 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -15400,9 +15733,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -15410,7 +15743,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15428,7 +15761,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -15443,9 +15776,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -15453,7 +15786,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15471,7 +15804,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -15486,9 +15819,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -15496,7 +15829,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15514,7 +15847,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -15529,9 +15862,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -15539,7 +15872,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15557,7 +15890,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -15580,18 +15913,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":786 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -15600,7 +15934,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":787 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -15609,7 +15943,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":790 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -15617,31 +15951,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":791 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":792 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -15650,20 +15989,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -15671,99 +16039,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_81), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":797 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":798 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_82), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":809 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -15771,16 +16138,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":810 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -15789,7 +16155,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":811 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -15798,430 +16164,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":812 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":814 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":816 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":817 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":818 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":819 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_84), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":822 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":823 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":824 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":825 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":840 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_79), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_79), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":841 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -16229,25 +16578,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":845 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":846 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -16276,7 +16625,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":961 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -16288,9 +16637,9 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":963 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -16300,7 +16649,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":964 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -16312,7 +16661,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":966 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -16321,7 +16670,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":967 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -16332,7 +16681,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":968 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -16341,7 +16690,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":969 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -16353,7 +16702,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":971 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -16365,9 +16714,9 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":972 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -16377,7 +16726,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":973 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -16392,7 +16741,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":975 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -16412,13 +16761,13 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("mu3_tet"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_mu3_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_mu3_tet)}, - {__Pyx_NAMESTR("mu2_tet"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_1mu2_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_1mu2_tet)}, - {__Pyx_NAMESTR("mu1_tet"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_2mu1_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_2mu1_tet)}, - {__Pyx_NAMESTR("_mu1_tetface"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_3_mu1_tetface, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("mu2_tri"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_4mu2_tri, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_4mu2_tri)}, - {__Pyx_NAMESTR("mu1_tri"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_5mu1_tri, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_5mu1_tri)}, - {__Pyx_NAMESTR("mu1_edge"), (PyCFunction)__pyx_pf_4nipy_10algorithms_10statistics_6intvol_6mu1_edge, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_6mu1_edge)}, + {__Pyx_NAMESTR("mu3_tet"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_1mu3_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_mu3_tet)}, + {__Pyx_NAMESTR("mu2_tet"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_3mu2_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_2mu2_tet)}, + {__Pyx_NAMESTR("mu1_tet"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_5mu1_tet, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_4mu1_tet)}, + {__Pyx_NAMESTR("_mu1_tetface"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_7_mu1_tetface, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("mu2_tri"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_9mu2_tri, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_8mu2_tri)}, + {__Pyx_NAMESTR("mu1_tri"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_11mu1_tri, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_10mu1_tri)}, + {__Pyx_NAMESTR("mu1_edge"), (PyCFunction)__pyx_pw_4nipy_10algorithms_10statistics_6intvol_13mu1_edge, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_10algorithms_10statistics_6intvol_12mu1_edge)}, {0, 0, 0, 0} }; @@ -16448,7 +16797,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_83, __pyx_k_83, sizeof(__pyx_k_83), 0, 1, 0, 0}, {&__pyx_n_s_86, __pyx_k_86, sizeof(__pyx_k_86), 0, 0, 1, 1}, {&__pyx_n_s_87, __pyx_k_87, sizeof(__pyx_k_87), 0, 0, 1, 1}, - {&__pyx_n_s_88, __pyx_k_88, sizeof(__pyx_k_88), 0, 0, 1, 1}, + {&__pyx_kp_s_90, __pyx_k_90, sizeof(__pyx_k_90), 0, 0, 1, 0}, + {&__pyx_n_s_91, __pyx_k_91, sizeof(__pyx_k_91), 0, 0, 1, 1}, + {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1}, {&__pyx_n_s__D00, __pyx_k__D00, sizeof(__pyx_k__D00), 0, 0, 1, 1}, {&__pyx_n_s__D01, __pyx_k__D01, sizeof(__pyx_k__D01), 0, 0, 1, 1}, {&__pyx_n_s__D02, __pyx_k__D02, sizeof(__pyx_k__D02), 0, 0, 1, 1}, @@ -16484,33 +16835,93 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s___convert_stride3, __pyx_k___convert_stride3, sizeof(__pyx_k___convert_stride3), 0, 0, 1, 1}, {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, {&__pyx_n_s__bool, __pyx_k__bool, sizeof(__pyx_k__bool), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, {&__pyx_n_s__coords, __pyx_k__coords, sizeof(__pyx_k__coords), 0, 0, 1, 1}, + {&__pyx_n_s__coords_c, __pyx_k__coords_c, sizeof(__pyx_k__coords_c), 0, 0, 1, 1}, + {&__pyx_n_s__cvertices, __pyx_k__cvertices, sizeof(__pyx_k__cvertices), 0, 0, 1, 1}, + {&__pyx_n_s__d2, __pyx_k__d2, sizeof(__pyx_k__d2), 0, 0, 1, 1}, + {&__pyx_n_s__d3, __pyx_k__d3, sizeof(__pyx_k__d3), 0, 0, 1, 1}, + {&__pyx_n_s__d4, __pyx_k__d4, sizeof(__pyx_k__d4), 0, 0, 1, 1}, {&__pyx_n_s__difference, __pyx_k__difference, sizeof(__pyx_k__difference), 0, 0, 1, 1}, {&__pyx_n_s__dok_matrix, __pyx_k__dok_matrix, sizeof(__pyx_k__dok_matrix), 0, 0, 1, 1}, + {&__pyx_n_s__ds2, __pyx_k__ds2, sizeof(__pyx_k__ds2), 0, 0, 1, 1}, + {&__pyx_n_s__ds3, __pyx_k__ds3, sizeof(__pyx_k__ds3), 0, 0, 1, 1}, + {&__pyx_n_s__ds4, __pyx_k__ds4, sizeof(__pyx_k__ds4), 0, 0, 1, 1}, + {&__pyx_n_s__dstrides, __pyx_k__dstrides, sizeof(__pyx_k__dstrides), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__fcoords, __pyx_k__fcoords, sizeof(__pyx_k__fcoords), 0, 0, 1, 1}, + {&__pyx_n_s__fmask, __pyx_k__fmask, sizeof(__pyx_k__fmask), 0, 0, 1, 1}, + {&__pyx_n_s__fpmask, __pyx_k__fpmask, sizeof(__pyx_k__fpmask), 0, 0, 1, 1}, {&__pyx_n_s__hstack, __pyx_k__hstack, sizeof(__pyx_k__hstack), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, {&__pyx_n_s__intp, __pyx_k__intp, sizeof(__pyx_k__intp), 0, 0, 1, 1}, {&__pyx_n_s__issubset, __pyx_k__issubset, sizeof(__pyx_k__issubset), 0, 0, 1, 1}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__join_complexes, __pyx_k__join_complexes, sizeof(__pyx_k__join_complexes), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__l, __pyx_k__l, sizeof(__pyx_k__l), 0, 0, 1, 1}, + {&__pyx_n_s__l0, __pyx_k__l0, sizeof(__pyx_k__l0), 0, 0, 1, 1}, + {&__pyx_n_s__l1, __pyx_k__l1, sizeof(__pyx_k__l1), 0, 0, 1, 1}, + {&__pyx_n_s__l2, __pyx_k__l2, sizeof(__pyx_k__l2), 0, 0, 1, 1}, + {&__pyx_n_s__l3, __pyx_k__l3, sizeof(__pyx_k__l3), 0, 0, 1, 1}, + {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1}, + {&__pyx_n_s__m2, __pyx_k__m2, sizeof(__pyx_k__m2), 0, 0, 1, 1}, + {&__pyx_n_s__m3, __pyx_k__m3, sizeof(__pyx_k__m3), 0, 0, 1, 1}, + {&__pyx_n_s__m4, __pyx_k__m4, sizeof(__pyx_k__m4), 0, 0, 1, 1}, {&__pyx_n_s__mask, __pyx_k__mask, sizeof(__pyx_k__mask), 0, 0, 1, 1}, + {&__pyx_n_s__mask_c, __pyx_k__mask_c, sizeof(__pyx_k__mask_c), 0, 0, 1, 1}, + {&__pyx_n_s__mr, __pyx_k__mr, sizeof(__pyx_k__mr), 0, 0, 1, 1}, + {&__pyx_n_s__ms, __pyx_k__ms, sizeof(__pyx_k__ms), 0, 0, 1, 1}, {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__npix, __pyx_k__npix, sizeof(__pyx_k__npix), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__nvox, __pyx_k__nvox, sizeof(__pyx_k__nvox), 0, 0, 1, 1}, {&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1}, + {&__pyx_n_s__pindex, __pyx_k__pindex, sizeof(__pyx_k__pindex), 0, 0, 1, 1}, + {&__pyx_n_s__pmask, __pyx_k__pmask, sizeof(__pyx_k__pmask), 0, 0, 1, 1}, + {&__pyx_n_s__pmask_shape, __pyx_k__pmask_shape, sizeof(__pyx_k__pmask_shape), 0, 0, 1, 1}, + {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__res, __pyx_k__res, sizeof(__pyx_k__res), 0, 0, 1, 1}, {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__rr, __pyx_k__rr, sizeof(__pyx_k__rr), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__s0, __pyx_k__s0, sizeof(__pyx_k__s0), 0, 0, 1, 1}, + {&__pyx_n_s__s1, __pyx_k__s1, sizeof(__pyx_k__s1), 0, 0, 1, 1}, + {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__sorted, __pyx_k__sorted, sizeof(__pyx_k__sorted), 0, 0, 1, 1}, {&__pyx_n_s__squeeze, __pyx_k__squeeze, sizeof(__pyx_k__squeeze), 0, 0, 1, 1}, + {&__pyx_n_s__ss, __pyx_k__ss, sizeof(__pyx_k__ss), 0, 0, 1, 1}, + {&__pyx_n_s__ss0, __pyx_k__ss0, sizeof(__pyx_k__ss0), 0, 0, 1, 1}, + {&__pyx_n_s__ss0d, __pyx_k__ss0d, sizeof(__pyx_k__ss0d), 0, 0, 1, 1}, + {&__pyx_n_s__ss1, __pyx_k__ss1, sizeof(__pyx_k__ss1), 0, 0, 1, 1}, + {&__pyx_n_s__ss1d, __pyx_k__ss1d, sizeof(__pyx_k__ss1d), 0, 0, 1, 1}, + {&__pyx_n_s__ss2, __pyx_k__ss2, sizeof(__pyx_k__ss2), 0, 0, 1, 1}, + {&__pyx_n_s__ss2d, __pyx_k__ss2d, sizeof(__pyx_k__ss2d), 0, 0, 1, 1}, {&__pyx_n_s__stride1, __pyx_k__stride1, sizeof(__pyx_k__stride1), 0, 0, 1, 1}, {&__pyx_n_s__stride2, __pyx_k__stride2, sizeof(__pyx_k__stride2), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, {&__pyx_n_s__strides_from, __pyx_k__strides_from, sizeof(__pyx_k__strides_from), 0, 0, 1, 1}, {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, + {&__pyx_n_s__union, __pyx_k__union, sizeof(__pyx_k__union), 0, 0, 1, 1}, {&__pyx_n_s__unique, __pyx_k__unique, sizeof(__pyx_k__unique), 0, 0, 1, 1}, {&__pyx_n_s__utils, __pyx_k__utils, sizeof(__pyx_k__utils), 0, 0, 1, 1}, {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1}, + {&__pyx_n_s__v0, __pyx_k__v0, sizeof(__pyx_k__v0), 0, 0, 1, 1}, + {&__pyx_n_s__v1, __pyx_k__v1, sizeof(__pyx_k__v1), 0, 0, 1, 1}, + {&__pyx_n_s__v2, __pyx_k__v2, sizeof(__pyx_k__v2), 0, 0, 1, 1}, + {&__pyx_n_s__v3, __pyx_k__v3, sizeof(__pyx_k__v3), 0, 0, 1, 1}, + {&__pyx_n_s__value, __pyx_k__value, sizeof(__pyx_k__value), 0, 0, 1, 1}, + {&__pyx_n_s__verts, __pyx_k__verts, sizeof(__pyx_k__verts), 0, 0, 1, 1}, + {&__pyx_n_s__w0, __pyx_k__w0, sizeof(__pyx_k__w0), 0, 0, 1, 1}, + {&__pyx_n_s__w1, __pyx_k__w1, sizeof(__pyx_k__w1), 0, 0, 1, 1}, + {&__pyx_n_s__w2, __pyx_k__w2, sizeof(__pyx_k__w2), 0, 0, 1, 1}, + {&__pyx_n_s__w3, __pyx_k__w3, sizeof(__pyx_k__w3), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; @@ -16518,7 +16929,7 @@ static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_sorted = __Pyx_GetName(__pyx_b, __pyx_n_s__sorted); if (!__pyx_builtin_sorted) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -16526,7 +16937,7 @@ static int __Pyx_InitCachedBuiltins(void) { static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); /* "nipy/algorithms/statistics/intvol.pyx":373 * """ @@ -16536,7 +16947,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_2)); + __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -16559,7 +16970,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); __pyx_k_tuple_6 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_6)); + __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(__pyx_k_slice_3); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, __pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); @@ -16579,7 +16990,7 @@ static int __Pyx_InitCachedConstants(void) { * np.ndarray[np.intp_t, ndim=1] strides */ __pyx_k_tuple_7 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_7)); + __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_7, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -16593,7 +17004,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((0,1,1), strides), */ __pyx_k_tuple_9 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_9)); + __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16613,7 +17024,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,0,0), strides), */ __pyx_k_tuple_10 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16633,7 +17044,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,0,1), strides), */ __pyx_k_tuple_11 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_11)); + __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16653,7 +17064,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1,0), strides), */ __pyx_k_tuple_12 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); + __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16673,7 +17084,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1,1), strides)]) */ __pyx_k_tuple_13 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_13)); + __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_13, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16693,7 +17104,7 @@ static int __Pyx_InitCachedConstants(void) { * c = cube_with_strides_center((0,0,0), strides) */ __pyx_k_tuple_14 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); + __Pyx_GOTREF(__pyx_k_tuple_14); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16713,7 +17124,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_15)); + __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16733,7 +17144,7 @@ static int __Pyx_InitCachedConstants(void) { * d4 = np.array(list(c[4].difference(union[4]))) */ __pyx_k_tuple_16 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_GOTREF(__pyx_k_tuple_16); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16753,7 +17164,7 @@ static int __Pyx_InitCachedConstants(void) { * mask = np.squeeze(mask) */ __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_INCREF(((PyObject *)__pyx_kp_s_17)); PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_s_17)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17)); @@ -16767,7 +17178,7 @@ static int __Pyx_InitCachedConstants(void) { * if mask.ndim == 2: */ __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); + __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_INCREF(__pyx_int_4); PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, __pyx_int_4); __Pyx_GIVEREF(__pyx_int_4); @@ -16781,7 +17192,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_GOTREF(__pyx_k_tuple_20); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -16804,7 +17215,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_23); __Pyx_GIVEREF(__pyx_k_slice_23); __pyx_k_tuple_24 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_GOTREF(__pyx_k_tuple_24); __Pyx_INCREF(__pyx_k_slice_21); PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, __pyx_k_slice_21); __Pyx_GIVEREF(__pyx_k_slice_21); @@ -16824,7 +17235,7 @@ static int __Pyx_InitCachedConstants(void) { * fcoords = coords_c.reshape((coords_c.shape[0], -1)) */ __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_25)); + __Pyx_GOTREF(__pyx_k_tuple_25); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -16838,7 +17249,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_GOTREF(__pyx_k_tuple_26); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -16852,7 +17263,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((0,1,1), strides), */ __pyx_k_tuple_27 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_27)); + __Pyx_GOTREF(__pyx_k_tuple_27); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16872,7 +17283,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,0,0), strides), */ __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_28)); + __Pyx_GOTREF(__pyx_k_tuple_28); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16892,7 +17303,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,0,1), strides), */ __pyx_k_tuple_29 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_29)); + __Pyx_GOTREF(__pyx_k_tuple_29); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -16912,7 +17323,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1,0), strides), */ __pyx_k_tuple_30 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_30)); + __Pyx_GOTREF(__pyx_k_tuple_30); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16932,7 +17343,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1,1), strides)]) */ __pyx_k_tuple_31 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_31)); + __Pyx_GOTREF(__pyx_k_tuple_31); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16952,7 +17363,7 @@ static int __Pyx_InitCachedConstants(void) { * c = cube_with_strides_center((0,0,0), strides) */ __pyx_k_tuple_32 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_32)); + __Pyx_GOTREF(__pyx_k_tuple_32); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16972,7 +17383,7 @@ static int __Pyx_InitCachedConstants(void) { * m4 = np.array(list(c[4].difference(union[4]))) */ __pyx_k_tuple_33 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_33)); + __Pyx_GOTREF(__pyx_k_tuple_33); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -16992,7 +17403,7 @@ static int __Pyx_InitCachedConstants(void) { * m3 = np.array(list(c[3].difference(union[3]))) */ __pyx_k_tuple_34 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_34)); + __Pyx_GOTREF(__pyx_k_tuple_34); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17012,7 +17423,7 @@ static int __Pyx_InitCachedConstants(void) { * ds4 = d4.shape[0] */ __pyx_k_tuple_35 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_35)); + __Pyx_GOTREF(__pyx_k_tuple_35); __Pyx_INCREF(__pyx_int_4); PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, __pyx_int_4); __Pyx_GIVEREF(__pyx_int_4); @@ -17032,7 +17443,7 @@ static int __Pyx_InitCachedConstants(void) { * ds3 = d3.shape[0] */ __pyx_k_tuple_36 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 599; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_36)); + __Pyx_GOTREF(__pyx_k_tuple_36); __Pyx_INCREF(__pyx_int_4); PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, __pyx_int_4); __Pyx_GIVEREF(__pyx_int_4); @@ -17052,7 +17463,7 @@ static int __Pyx_InitCachedConstants(void) { * ds2 = d2.shape[0] */ __pyx_k_tuple_37 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_37)); + __Pyx_GOTREF(__pyx_k_tuple_37); __Pyx_INCREF(__pyx_int_4); PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, __pyx_int_4); __Pyx_GIVEREF(__pyx_int_4); @@ -17072,7 +17483,7 @@ static int __Pyx_InitCachedConstants(void) { * for i in range(s0-1): */ __pyx_k_tuple_38 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_38)); + __Pyx_GOTREF(__pyx_k_tuple_38); __Pyx_INCREF(__pyx_int_8); PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, __pyx_int_8); __Pyx_GIVEREF(__pyx_int_8); @@ -17081,7 +17492,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_8); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); __pyx_k_tuple_39 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_39)); + __Pyx_GOTREF(__pyx_k_tuple_39); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_38)); PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_k_tuple_38)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38)); @@ -17095,7 +17506,7 @@ static int __Pyx_InitCachedConstants(void) { * mask = np.squeeze(mask) */ __pyx_k_tuple_40 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_40)); + __Pyx_GOTREF(__pyx_k_tuple_40); __Pyx_INCREF(((PyObject *)__pyx_kp_s_17)); PyTuple_SET_ITEM(__pyx_k_tuple_40, 0, ((PyObject *)__pyx_kp_s_17)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17)); @@ -17109,7 +17520,7 @@ static int __Pyx_InitCachedConstants(void) { * value[:2] = Lips1d(coords, mask) */ __pyx_k_tuple_41 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_41)); + __Pyx_GOTREF(__pyx_k_tuple_41); __Pyx_INCREF(__pyx_int_3); PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, __pyx_int_3); __Pyx_GIVEREF(__pyx_int_3); @@ -17123,7 +17534,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_42 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_42)); + __Pyx_GOTREF(__pyx_k_tuple_42); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_42, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -17143,7 +17554,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_44); __Pyx_GIVEREF(__pyx_k_slice_44); __pyx_k_tuple_45 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_45)); + __Pyx_GOTREF(__pyx_k_tuple_45); __Pyx_INCREF(__pyx_k_slice_43); PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, __pyx_k_slice_43); __Pyx_GIVEREF(__pyx_k_slice_43); @@ -17160,7 +17571,7 @@ static int __Pyx_InitCachedConstants(void) { * fcoords = coords.reshape((coords.shape[0], -1)) */ __pyx_k_tuple_46 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_46)); + __Pyx_GOTREF(__pyx_k_tuple_46); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_46, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -17174,7 +17585,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_47 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_47)); + __Pyx_GOTREF(__pyx_k_tuple_47); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -17188,7 +17599,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1), strides)]) */ __pyx_k_tuple_48 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_48)); + __Pyx_GOTREF(__pyx_k_tuple_48); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_48, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17205,7 +17616,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_49 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_49)); + __Pyx_GOTREF(__pyx_k_tuple_49); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -17222,7 +17633,7 @@ static int __Pyx_InitCachedConstants(void) { * c = cube_with_strides_center((0,0), strides) */ __pyx_k_tuple_50 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_50)); + __Pyx_GOTREF(__pyx_k_tuple_50); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_50, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -17239,7 +17650,7 @@ static int __Pyx_InitCachedConstants(void) { * m2 = np.array(list(c[2].difference(union[2]))) */ __pyx_k_tuple_51 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_51)); + __Pyx_GOTREF(__pyx_k_tuple_51); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17256,7 +17667,7 @@ static int __Pyx_InitCachedConstants(void) { * ds3 = d3.shape[0] */ __pyx_k_tuple_52 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_52)); + __Pyx_GOTREF(__pyx_k_tuple_52); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_k_tuple_52, 0, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); @@ -17273,7 +17684,7 @@ static int __Pyx_InitCachedConstants(void) { * ds2 = d2.shape[0] */ __pyx_k_tuple_53 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_53)); + __Pyx_GOTREF(__pyx_k_tuple_53); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); @@ -17290,7 +17701,7 @@ static int __Pyx_InitCachedConstants(void) { * npix = mask.size */ __pyx_k_tuple_54 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_54)); + __Pyx_GOTREF(__pyx_k_tuple_54); __Pyx_INCREF(__pyx_int_4); PyTuple_SET_ITEM(__pyx_k_tuple_54, 0, __pyx_int_4); __Pyx_GIVEREF(__pyx_int_4); @@ -17299,7 +17710,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_4); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); __pyx_k_tuple_55 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_55)); + __Pyx_GOTREF(__pyx_k_tuple_55); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_54)); PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_k_tuple_54)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_54)); @@ -17313,7 +17724,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_56 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 937; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_56)); + __Pyx_GOTREF(__pyx_k_tuple_56); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_56, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -17333,7 +17744,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_58); __Pyx_GIVEREF(__pyx_k_slice_58); __pyx_k_tuple_59 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 958; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_59)); + __Pyx_GOTREF(__pyx_k_tuple_59); __Pyx_INCREF(__pyx_k_slice_57); PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, __pyx_k_slice_57); __Pyx_GIVEREF(__pyx_k_slice_57); @@ -17350,7 +17761,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_60 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 962; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_60)); + __Pyx_GOTREF(__pyx_k_tuple_60); __Pyx_INCREF(__pyx_int_neg_1); PyTuple_SET_ITEM(__pyx_k_tuple_60, 0, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); @@ -17364,7 +17775,7 @@ static int __Pyx_InitCachedConstants(void) { * cube_with_strides_center((1,1), strides)]) */ __pyx_k_tuple_61 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_61)); + __Pyx_GOTREF(__pyx_k_tuple_61); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17381,7 +17792,7 @@ static int __Pyx_InitCachedConstants(void) { * c = cube_with_strides_center((0,0), strides) */ __pyx_k_tuple_62 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_62)); + __Pyx_GOTREF(__pyx_k_tuple_62); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_62, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -17398,7 +17809,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_63 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_63)); + __Pyx_GOTREF(__pyx_k_tuple_63); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -17415,7 +17826,7 @@ static int __Pyx_InitCachedConstants(void) { * d3 = np.array(list(c[3].difference(union[3]))) */ __pyx_k_tuple_64 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_64)); + __Pyx_GOTREF(__pyx_k_tuple_64); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_64, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17432,7 +17843,7 @@ static int __Pyx_InitCachedConstants(void) { * raise ValueError('mask should be filled with 0/1 ' */ __pyx_k_tuple_65 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1043; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_65)); + __Pyx_GOTREF(__pyx_k_tuple_65); __Pyx_INCREF(((PyObject *)__pyx_kp_s_17)); PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_kp_s_17)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17)); @@ -17446,7 +17857,7 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_66 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1045; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_66)); + __Pyx_GOTREF(__pyx_k_tuple_66); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_66, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); @@ -17460,7 +17871,7 @@ static int __Pyx_InitCachedConstants(void) { * for i in range(s0): */ __pyx_k_tuple_67 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_67)); + __Pyx_GOTREF(__pyx_k_tuple_67); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); @@ -17469,7 +17880,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); __pyx_k_tuple_68 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_68)); + __Pyx_GOTREF(__pyx_k_tuple_68); __Pyx_INCREF(((PyObject *)__pyx_k_tuple_67)); PyTuple_SET_ITEM(__pyx_k_tuple_68, 0, ((PyObject *)__pyx_k_tuple_67)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); @@ -17483,7 +17894,7 @@ static int __Pyx_InitCachedConstants(void) { * */ __pyx_k_tuple_69 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_69)); + __Pyx_GOTREF(__pyx_k_tuple_69); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17492,7 +17903,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_0); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); __pyx_k_tuple_70 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_70)); + __Pyx_GOTREF(__pyx_k_tuple_70); __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_k_tuple_70, 0, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -17501,7 +17912,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GIVEREF(__pyx_int_1); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_70)); __pyx_k_tuple_71 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_71)); + __Pyx_GOTREF(__pyx_k_tuple_71); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); @@ -17518,95 +17929,839 @@ static int __Pyx_InitCachedConstants(void) { * cdef: */ __pyx_k_tuple_72 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_72)); + __Pyx_GOTREF(__pyx_k_tuple_72); __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); PyTuple_SET_ITEM(__pyx_k_tuple_72, 0, ((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_72)); - /* "numpy.pxd":211 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_74)); + __pyx_k_tuple_74 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_74)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_74); __Pyx_INCREF(((PyObject *)__pyx_kp_u_73)); PyTuple_SET_ITEM(__pyx_k_tuple_74, 0, ((PyObject *)__pyx_kp_u_73)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_73)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_74)); - /* "numpy.pxd":215 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_76)); + __pyx_k_tuple_76 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_76)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_76); __Pyx_INCREF(((PyObject *)__pyx_kp_u_75)); PyTuple_SET_ITEM(__pyx_k_tuple_76, 0, ((PyObject *)__pyx_kp_u_75)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_75)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_76)); - /* "numpy.pxd":253 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_78)); + __pyx_k_tuple_78 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_78)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_78); __Pyx_INCREF(((PyObject *)__pyx_kp_u_77)); PyTuple_SET_ITEM(__pyx_k_tuple_78, 0, ((PyObject *)__pyx_kp_u_77)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_77)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_78)); - /* "numpy.pxd":795 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_81)); + __pyx_k_tuple_81 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_81)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_81); __Pyx_INCREF(((PyObject *)__pyx_kp_u_80)); PyTuple_SET_ITEM(__pyx_k_tuple_81, 0, ((PyObject *)__pyx_kp_u_80)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_80)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_81)); - /* "numpy.pxd":799 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_82)); + __pyx_k_tuple_82 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_82)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_82); __Pyx_INCREF(((PyObject *)__pyx_kp_u_77)); PyTuple_SET_ITEM(__pyx_k_tuple_82, 0, ((PyObject *)__pyx_kp_u_77)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_77)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_82)); - /* "numpy.pxd":819 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_84)); + __pyx_k_tuple_84 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_84)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_84); __Pyx_INCREF(((PyObject *)__pyx_kp_u_83)); PyTuple_SET_ITEM(__pyx_k_tuple_84, 0, ((PyObject *)__pyx_kp_u_83)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_83)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_84)); + + /* "nipy/algorithms/statistics/intvol.pyx":340 + * + * + * def EC3d(mask): # <<<<<<<<<<<<<< + * """ Compute Euler characteristic of region within `mask` + * + */ + __pyx_k_tuple_88 = PyTuple_New(32); if (unlikely(!__pyx_k_tuple_88)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_88); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 0, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 1, ((PyObject *)__pyx_n_s__mask_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fpmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 2, ((PyObject *)__pyx_n_s__fpmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fpmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 3, ((PyObject *)__pyx_n_s__d2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d3)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 4, ((PyObject *)__pyx_n_s__d3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d4)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 5, ((PyObject *)__pyx_n_s__d4)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 6, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 7, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 8, ((PyObject *)__pyx_n_s__k)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 9, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 10, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s1)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 11, ((PyObject *)__pyx_n_s__s1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 12, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 13, ((PyObject *)__pyx_n_s__ds2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds3)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 14, ((PyObject *)__pyx_n_s__ds3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds4)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 15, ((PyObject *)__pyx_n_s__ds4)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 16, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 17, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 18, ((PyObject *)__pyx_n_s__nvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 19, ((PyObject *)__pyx_n_s__ss0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 20, ((PyObject *)__pyx_n_s__ss1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 21, ((PyObject *)__pyx_n_s__ss2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 22, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 23, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 24, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v3)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 25, ((PyObject *)__pyx_n_s__v3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 26, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask_shape)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 27, ((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 28, ((PyObject *)__pyx_n_s__pmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__strides)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 29, ((PyObject *)__pyx_n_s__strides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__union)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 30, ((PyObject *)__pyx_n_s__union)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__union)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_88, 31, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_88)); + __pyx_k_codeobj_89 = (PyObject*)__Pyx_PyCode_New(1, 0, 32, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_88, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__EC3d, 340, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_89)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":464 + * + * + * def Lips3d(coords, mask): # <<<<<<<<<<<<<< + * """ Estimated intrinsic volumes within masked region given coordinates + * + */ + __pyx_k_tuple_92 = PyTuple_New(63); if (unlikely(!__pyx_k_tuple_92)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_92); + __Pyx_INCREF(((PyObject *)__pyx_n_s__coords)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 0, ((PyObject *)__pyx_n_s__coords)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coords)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 1, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__value)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 2, ((PyObject *)__pyx_n_s__value)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__coords_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 3, ((PyObject *)__pyx_n_s__coords_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coords_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 4, ((PyObject *)__pyx_n_s__mask_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fcoords)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 5, ((PyObject *)__pyx_n_s__fcoords)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fcoords)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 6, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 7, ((PyObject *)__pyx_n_s__fmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fpmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 8, ((PyObject *)__pyx_n_s__fpmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fpmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 9, ((PyObject *)__pyx_n_s__pmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d4)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 10, ((PyObject *)__pyx_n_s__d4)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m4)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 11, ((PyObject *)__pyx_n_s__m4)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 12, ((PyObject *)__pyx_n_s__d3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 13, ((PyObject *)__pyx_n_s__m3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 14, ((PyObject *)__pyx_n_s__d2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 15, ((PyObject *)__pyx_n_s__m2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__cvertices)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 16, ((PyObject *)__pyx_n_s__cvertices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cvertices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 17, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 18, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 19, ((PyObject *)__pyx_n_s__k)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 20, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 21, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 22, ((PyObject *)__pyx_n_s__s1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 23, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds4)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 24, ((PyObject *)__pyx_n_s__ds4)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds4)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 25, ((PyObject *)__pyx_n_s__ds3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 26, ((PyObject *)__pyx_n_s__ds2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 27, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pindex)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 28, ((PyObject *)__pyx_n_s__pindex)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pindex)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 29, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nvox)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 30, ((PyObject *)__pyx_n_s__nvox)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nvox)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 31, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 32, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rr)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 33, ((PyObject *)__pyx_n_s__rr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 34, ((PyObject *)__pyx_n_s__ss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mr)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 35, ((PyObject *)__pyx_n_s__mr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ms)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 36, ((PyObject *)__pyx_n_s__ms)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ms)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 37, ((PyObject *)__pyx_n_s__ss0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 38, ((PyObject *)__pyx_n_s__ss1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 39, ((PyObject *)__pyx_n_s__ss2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 40, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 41, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 42, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 43, ((PyObject *)__pyx_n_s__v3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w0)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 44, ((PyObject *)__pyx_n_s__w0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 45, ((PyObject *)__pyx_n_s__w1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 46, ((PyObject *)__pyx_n_s__w2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 47, ((PyObject *)__pyx_n_s__w3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 48, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l1)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 49, ((PyObject *)__pyx_n_s__l1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l2)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 50, ((PyObject *)__pyx_n_s__l2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l3)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 51, ((PyObject *)__pyx_n_s__l3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__res)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 52, ((PyObject *)__pyx_n_s__res)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask_shape)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 53, ((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__strides)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 54, ((PyObject *)__pyx_n_s__strides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dstrides)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 55, ((PyObject *)__pyx_n_s__dstrides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dstrides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0d)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 56, ((PyObject *)__pyx_n_s__ss0d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1d)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 57, ((PyObject *)__pyx_n_s__ss1d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss2d)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 58, ((PyObject *)__pyx_n_s__ss2d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss2d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__verts)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 59, ((PyObject *)__pyx_n_s__verts)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verts)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__union)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 60, ((PyObject *)__pyx_n_s__union)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__union)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 61, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_92, 62, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_92)); + __pyx_k_codeobj_93 = (PyObject*)__Pyx_PyCode_New(2, 0, 63, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_92, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__Lips3d, 464, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_93)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":699 + * + * + * def _convert_stride3(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + __pyx_k_tuple_94 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_94)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_94); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 0, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride1)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 1, ((PyObject *)__pyx_n_s__stride1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride2)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 2, ((PyObject *)__pyx_n_s__stride2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 3, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 4, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_94, 5, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_94)); + __pyx_k_codeobj_95 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_94, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s___convert_stride3, 699, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_95)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":711 + * + * + * def _convert_stride2(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + __pyx_k_tuple_96 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_96)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_96); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 0, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride1)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 1, ((PyObject *)__pyx_n_s__stride1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride2)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 2, ((PyObject *)__pyx_n_s__stride2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 3, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_96, 4, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_96)); + __pyx_k_codeobj_97 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_96, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s___convert_stride2, 711, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_97)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":721 + * + * + * def _convert_stride1(v, stride1, stride2): # <<<<<<<<<<<<<< + * """ + * Take a voxel, expressed as in index in stride1 and + */ + __pyx_k_tuple_98 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_98)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_98); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_98, 0, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride1)); + PyTuple_SET_ITEM(__pyx_k_tuple_98, 1, ((PyObject *)__pyx_n_s__stride1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride2)); + PyTuple_SET_ITEM(__pyx_k_tuple_98, 2, ((PyObject *)__pyx_n_s__stride2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_98, 3, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_98)); + __pyx_k_codeobj_99 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_98, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s___convert_stride1, 721, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_99)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":730 + * + * + * def Lips2d(coords, mask): # <<<<<<<<<<<<<< + * """ Estimate intrinsic volumes for 2d region in `mask` given `coords` + * + */ + __pyx_k_tuple_100 = PyTuple_New(54); if (unlikely(!__pyx_k_tuple_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_100); + __Pyx_INCREF(((PyObject *)__pyx_n_s__coords)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 0, ((PyObject *)__pyx_n_s__coords)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coords)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 1, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__value)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 2, ((PyObject *)__pyx_n_s__value)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__value)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__coords_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 3, ((PyObject *)__pyx_n_s__coords_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coords_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 4, ((PyObject *)__pyx_n_s__mask_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fcoords)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 5, ((PyObject *)__pyx_n_s__fcoords)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fcoords)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 6, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 7, ((PyObject *)__pyx_n_s__fmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fpmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 8, ((PyObject *)__pyx_n_s__fpmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fpmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 9, ((PyObject *)__pyx_n_s__pmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d3)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 10, ((PyObject *)__pyx_n_s__d3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 11, ((PyObject *)__pyx_n_s__d2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__cvertices)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 12, ((PyObject *)__pyx_n_s__cvertices)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__cvertices)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 13, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 14, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 15, ((PyObject *)__pyx_n_s__k)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 16, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 17, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 18, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rr)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 19, ((PyObject *)__pyx_n_s__rr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 20, ((PyObject *)__pyx_n_s__ss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mr)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 21, ((PyObject *)__pyx_n_s__mr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ms)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 22, ((PyObject *)__pyx_n_s__ms)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ms)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 23, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s1)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 24, ((PyObject *)__pyx_n_s__s1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 25, ((PyObject *)__pyx_n_s__ds2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds3)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 26, ((PyObject *)__pyx_n_s__ds3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 27, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 28, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__npix)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 29, ((PyObject *)__pyx_n_s__npix)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__npix)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 30, ((PyObject *)__pyx_n_s__ss0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 31, ((PyObject *)__pyx_n_s__ss1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0d)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 32, ((PyObject *)__pyx_n_s__ss0d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1d)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 33, ((PyObject *)__pyx_n_s__ss1d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 34, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 35, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 36, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 37, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l1)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 38, ((PyObject *)__pyx_n_s__l1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 39, ((PyObject *)__pyx_n_s__l2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__res)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 40, ((PyObject *)__pyx_n_s__res)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask_shape)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 41, ((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__strides)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 42, ((PyObject *)__pyx_n_s__strides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dstrides)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 43, ((PyObject *)__pyx_n_s__dstrides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dstrides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__verts)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 44, ((PyObject *)__pyx_n_s__verts)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__verts)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__union)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 45, ((PyObject *)__pyx_n_s__union)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__union)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 46, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m3)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 47, ((PyObject *)__pyx_n_s__m3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 48, ((PyObject *)__pyx_n_s__m2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pindex)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 49, ((PyObject *)__pyx_n_s__pindex)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pindex)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w0)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 50, ((PyObject *)__pyx_n_s__w0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w1)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 51, ((PyObject *)__pyx_n_s__w1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w2)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 52, ((PyObject *)__pyx_n_s__w2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_100, 53, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_100)); + __pyx_k_codeobj_101 = (PyObject*)__Pyx_PyCode_New(2, 0, 54, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_100, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__Lips2d, 730, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_101)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":907 + * + * + * def EC2d(mask): # <<<<<<<<<<<<<< + * """ Compute Euler characteristic of 2D region in `mask` + * + */ + __pyx_k_tuple_102 = PyTuple_New(26); if (unlikely(!__pyx_k_tuple_102)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_102); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 0, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask_c)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 1, ((PyObject *)__pyx_n_s__mask_c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask_c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fpmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 2, ((PyObject *)__pyx_n_s__fpmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fpmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d2)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 3, ((PyObject *)__pyx_n_s__d2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d3)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 4, ((PyObject *)__pyx_n_s__d3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 5, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 6, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__k)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 7, ((PyObject *)__pyx_n_s__k)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__k)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 8, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 9, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s1)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 10, ((PyObject *)__pyx_n_s__s1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds2)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 11, ((PyObject *)__pyx_n_s__ds2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ds3)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 12, ((PyObject *)__pyx_n_s__ds3)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ds3)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 13, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 14, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss0)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 15, ((PyObject *)__pyx_n_s__ss0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss1)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 16, ((PyObject *)__pyx_n_s__ss1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v0)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 17, ((PyObject *)__pyx_n_s__v0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 18, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 19, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask_shape)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 20, ((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask_shape)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__pmask)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 21, ((PyObject *)__pyx_n_s__pmask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__pmask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__strides)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 22, ((PyObject *)__pyx_n_s__strides)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strides)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__union)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 23, ((PyObject *)__pyx_n_s__union)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__union)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 24, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_102, 25, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_102)); + __pyx_k_codeobj_103 = (PyObject*)__Pyx_PyCode_New(1, 0, 26, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_102, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__EC2d, 907, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_103)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":1007 + * + * + * def Lips1d(np.ndarray[np.float_t, ndim=2] coords, # <<<<<<<<<<<<<< + * np.ndarray[np.intp_t, ndim=1] mask): + * """ Estimate intrinsic volumes for 1D region in `mask` given `coords` + */ + __pyx_k_tuple_104 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_104)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_104); + __Pyx_INCREF(((PyObject *)__pyx_n_s__coords)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 0, ((PyObject *)__pyx_n_s__coords)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__coords)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 1, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 2, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 3, ((PyObject *)__pyx_n_s__l)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 4, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 5, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rr)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 6, ((PyObject *)__pyx_n_s__rr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ss)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 7, ((PyObject *)__pyx_n_s__ss)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ss)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mr)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 8, ((PyObject *)__pyx_n_s__mr)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mr)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ms)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 9, ((PyObject *)__pyx_n_s__ms)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ms)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 10, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 11, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 12, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 13, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l1)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 14, ((PyObject *)__pyx_n_s__l1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__res)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 15, ((PyObject *)__pyx_n_s__res)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__res)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_104, 16, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_104)); + __pyx_k_codeobj_105 = (PyObject*)__Pyx_PyCode_New(2, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_104, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__Lips1d, 1007, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_105)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/algorithms/statistics/intvol.pyx":1083 + * + * + * def EC1d(np.ndarray[np.intp_t, ndim=1] mask): # <<<<<<<<<<<<<< + * """ Compute Euler characteristic for 1d `mask` + * + */ + __pyx_k_tuple_106 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_106)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_106); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mask)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 0, ((PyObject *)__pyx_n_s__mask)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mask)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 2, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s0)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 3, ((PyObject *)__pyx_n_s__s0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__l0)); + PyTuple_SET_ITEM(__pyx_k_tuple_106, 4, ((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__l0)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_106)); + __pyx_k_codeobj_107 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_106, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_90, __pyx_n_s__EC1d, 1083, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_107)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -17615,9 +18770,6 @@ static int __Pyx_InitCachedConstants(void) { } static int __Pyx_InitGlobals(void) { - #if PY_VERSION_HEX < 0x02040000 - if (unlikely(__Pyx_Py23SetsImport() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #endif if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; @@ -17653,12 +18805,18 @@ PyMODINIT_FUNC PyInit_intvol(void) Py_FatalError("failed to import 'refnanny' module"); } #endif - __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_intvol(void)"); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_intvol(void)", 0); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #ifdef __pyx_binding_PyCFunctionType_USED - if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -17669,16 +18827,23 @@ PyMODINIT_FUNC PyInit_intvol(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("intvol"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_85), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("intvol"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_85), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.algorithms.statistics.intvol")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.algorithms.statistics.intvol", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -17694,11 +18859,18 @@ PyMODINIT_FUNC PyInit_intvol(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 857; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -17723,14 +18895,18 @@ PyMODINIT_FUNC PyInit_intvol(void) * # Array helper */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__dok_matrix)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__dok_matrix)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dok_matrix)); __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_86), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dok_matrix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dok_matrix); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__dok_matrix); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__dok_matrix, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17744,14 +18920,18 @@ PyMODINIT_FUNC PyInit_intvol(void) * # local imports */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_n_s__strides_from)); PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__strides_from)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__strides_from)); __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_87), ((PyObject *)__pyx_t_2), -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strides_from); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__strides_from); + if (__pyx_t_2 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__strides_from); + if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__strides_from, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -17765,7 +18945,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * */ __pyx_t_1 = PyList_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s_8)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_8)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s_8)); @@ -17775,11 +18955,19 @@ PyMODINIT_FUNC PyInit_intvol(void) __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__utils), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s_8); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s_8); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s_8, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__join_complexes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__join_complexes); + if (__pyx_t_1 == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) __Pyx_RaiseImportError(__pyx_n_s__join_complexes); + if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__join_complexes, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17808,7 +18996,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ Compute Euler characteristic of region within `mask` * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_7EC3d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_15EC3d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EC3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17820,7 +19008,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ Estimated intrinsic volumes within masked region given coordinates * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_8Lips3d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_17Lips3d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Lips3d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17832,7 +19020,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ * Take a voxel, expressed as in index in stride1 and */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_9_convert_stride3, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_19_convert_stride3, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___convert_stride3, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17844,7 +19032,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ * Take a voxel, expressed as in index in stride1 and */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_10_convert_stride2, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_21_convert_stride2, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___convert_stride2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17856,7 +19044,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ * Take a voxel, expressed as in index in stride1 and */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_11_convert_stride1, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_23_convert_stride1, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s___convert_stride1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17868,7 +19056,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ Estimate intrinsic volumes for 2d region in `mask` given `coords` * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_12Lips2d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_25Lips2d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Lips2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17880,7 +19068,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ Compute Euler characteristic of 2D region in `mask` * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_13EC2d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_27EC2d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EC2d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17892,7 +19080,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * np.ndarray[np.intp_t, ndim=1] mask): * """ Estimate intrinsic volumes for 1D region in `mask` given `coords` */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_14Lips1d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_29Lips1d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__Lips1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17904,7 +19092,7 @@ PyMODINIT_FUNC PyInit_intvol(void) * """ Compute Euler characteristic for 1d `mask` * */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_15EC1d, NULL, __pyx_n_s_88); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_10algorithms_10statistics_6intvol_31EC1d, NULL, __pyx_n_s_91); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__EC1d, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -17919,7 +19107,7 @@ PyMODINIT_FUNC PyInit_intvol(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":971 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -17946,7 +19134,6 @@ PyMODINIT_FUNC PyInit_intvol(void) } /* Runtime support code */ - #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; @@ -17987,7 +19174,6 @@ static void __Pyx_RaiseArgtupleInvalid( { Py_ssize_t num_expected; const char *more_or_less; - if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -17999,7 +19185,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -18013,7 +19199,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -18029,55 +19215,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -18097,9 +19305,9 @@ static int __Pyx_ParseOptionalKeywords( } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -18109,55 +19317,60 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - #if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - /* cause is unused */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -18180,7 +19393,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -18189,10 +19401,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tb); return; } - #else /* Python 3+ */ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -18202,7 +19413,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } if (value == Py_None) value = 0; - if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, @@ -18211,13 +19421,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -18234,14 +19467,9 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } - PyErr_SetObject(type, value); - if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; @@ -18251,8 +19479,8 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject Py_XDECREF(tmp_tb); } } - bad: + Py_XDECREF(owned_instance); return; } #endif @@ -18273,18 +19501,6 @@ static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - size_t new_count, enc_count; - int is_complex; - char enc_type; - char new_packmode; - char enc_packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -18303,6 +19519,8 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -18310,7 +19528,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -18326,15 +19543,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -18350,14 +19573,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -18373,10 +19596,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -18393,7 +19615,6 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -18404,10 +19625,9 @@ typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); @@ -18423,21 +19643,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -18462,16 +19720,37 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { @@ -18483,35 +19762,35 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d but %"PY_FORMAT_SIZE_T"d expected", + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -18543,7 +19822,48 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { ctx->is_complex = 0; return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -18558,7 +19878,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -18590,12 +19910,17 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha { const char* ts_after_sub; size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -18603,10 +19928,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -18627,13 +19961,11 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': + case 'O': case 's': case 'p': if (ctx->enc_type == *ts && got_Z == ctx->is_complex && ctx->enc_packmode == ctx->new_packmode) { - /* Continue pooling same type */ ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; ctx->enc_packmode = ctx->new_packmode; @@ -18649,20 +19981,18 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha while(*ts != ':') ++ts; ++ts; break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - int number = __Pyx_BufFmt_ParseNumber(&ts); - if (number == -1) { /* First char was not a digit */ - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%c')", *ts); - return NULL; - } - ctx->new_count = (size_t)number; + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -18670,8 +20000,10 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; @@ -18691,7 +20023,7 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* ob } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; @@ -18702,7 +20034,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -18714,17 +20045,11 @@ static void __Pyx_RaiseBufferFallbackError(void) { "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } - static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } - -static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { - PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); -} - static CYTHON_INLINE int __Pyx_mod_int(int a, int b) { int r = a % b; r += ((r != 0) & ((r ^ b) < 0)) * b; @@ -18757,58 +20082,140 @@ static CYTHON_INLINE long __Pyx_mod_long(long a, long b) { return r; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { - #if PY_VERSION_HEX >= 0x02060000 - if (PyObject_CheckBuffer(obj)) {PyBuffer_Release(view); return;} - #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray_1__releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; @@ -18834,12 +20241,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -18856,6 +20284,15 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { return module; } +static CYTHON_INLINE void __Pyx_RaiseImportError(PyObject *name) { +#if PY_MAJOR_VERSION < 3 + PyErr_Format(PyExc_ImportError, "cannot import name %.230s", + PyString_AsString(name)); +#else + PyErr_Format(PyExc_ImportError, "cannot import name %S", name); +#endif +} + static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; const int is_unsigned = const_zero < neg_one; @@ -18885,6 +20322,10 @@ static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { else return (Py_intptr_t)__Pyx_PyInt_AsSignedLongLong(x); } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else Py_intptr_t val; PyObject *v = __Pyx_PyNumber_Int(x); #if PY_VERSION_HEX < 0x03000000 @@ -18904,6 +20345,7 @@ static CYTHON_INLINE Py_intptr_t __Pyx_PyInt_from_py_Py_intptr_t(PyObject* x) { if (likely(!ret)) return val; } + #endif return (Py_intptr_t)-1; } } @@ -19592,6 +21034,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -19601,15 +21060,10 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -19625,7 +21079,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > (Py_ssize_t)size) { + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); @@ -19635,7 +21089,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; #endif } - else if (((PyTypeObject *)result)->tp_basicsize != (Py_ssize_t)size) { + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); @@ -19649,51 +21103,105 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, - int __pyx_lineno, const char *__pyx_filename) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -19704,28 +21212,45 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -19733,11 +21258,9 @@ static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -19772,6 +21295,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { diff --git a/nipy/labs/bindings/array.c b/nipy/labs/bindings/array.c index 7b6fff3ea7..59a91bf3cb 100644 --- a/nipy/labs/bindings/array.c +++ b/nipy/labs/bindings/array.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:43:47 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:32 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__bindings__array #define __PYX_HAVE_API__nipy__labs__bindings__array -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -162,120 +260,79 @@ #include "fff_matrix.h" #include "fff_array.h" #include "fffpy.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -286,8 +343,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -298,7 +353,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -306,52 +360,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "array.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -372,20 +589,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -396,60 +640,76 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -463,7 +723,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -484,11 +743,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -499,7 +764,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -514,11 +782,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -529,16 +803,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -557,6 +827,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -569,65 +841,104 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ -/* Module declarations from stdio */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.bindings.array */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.bindings.array' */ #define __Pyx_MODULE_NAME "nipy.labs.bindings.array" int __pyx_module_is_main_nipy__labs__bindings__array = 0; -/* Implementation of nipy.labs.bindings.array */ +/* Implementation of 'nipy.labs.bindings.array' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_x, size_t __pyx_v_y, size_t __pyx_v_z, size_t __pyx_v_t); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_2array_get_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_x0, size_t __pyx_v_x1, size_t __pyx_v_fX, size_t __pyx_v_y0, size_t __pyx_v_y1, size_t __pyx_v_fY, size_t __pyx_v_z0, size_t __pyx_v_z1, size_t __pyx_v_fZ, size_t __pyx_v_t0, size_t __pyx_v_t1, size_t __pyx_v_fT); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_4array_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_6array_mul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_8array_sub(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_10array_div(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nPython access to core fff functions written in C. This module is\nmainly used for unitary tests.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nPython access to core fff functions written in C. This module is\nmainly used for unitary tests.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/bindings/array.pyx"; +static char __pyx_k_18[] = "nipy.labs.bindings.array"; static char __pyx_k__A[] = "A"; static char __pyx_k__B[] = "B"; +static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; +static char __pyx_k__a[] = "a"; static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; @@ -649,81 +960,65 @@ static char __pyx_k__fZ[] = "fZ"; static char __pyx_k__np[] = "np"; static char __pyx_k__t0[] = "t0"; static char __pyx_k__t1[] = "t1"; +static char __pyx_k__va[] = "va"; static char __pyx_k__x0[] = "x0"; static char __pyx_k__x1[] = "x1"; static char __pyx_k__y0[] = "y0"; static char __pyx_k__y1[] = "y1"; static char __pyx_k__z0[] = "z0"; static char __pyx_k__z1[] = "z1"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__dimT[] = "dimT"; -static char __pyx_k__dimX[] = "dimX"; -static char __pyx_k__dimY[] = "dimY"; -static char __pyx_k__dimZ[] = "dimZ"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__asub[] = "asub"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__datatype[] = "datatype"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__array_add[] = "array_add"; +static char __pyx_k__array_div[] = "array_div"; +static char __pyx_k__array_get[] = "array_get"; +static char __pyx_k__array_mul[] = "array_mul"; +static char __pyx_k__array_sub[] = "array_sub"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__array_get_block[] = "array_get_block"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__A; static PyObject *__pyx_n_s__B; +static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__datatype; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__dimT; -static PyObject *__pyx_n_s__dimX; -static PyObject *__pyx_n_s__dimY; -static PyObject *__pyx_n_s__dimZ; +static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__array_add; +static PyObject *__pyx_n_s__array_div; +static PyObject *__pyx_n_s__array_get; +static PyObject *__pyx_n_s__array_get_block; +static PyObject *__pyx_n_s__array_mul; +static PyObject *__pyx_n_s__array_sub; +static PyObject *__pyx_n_s__asub; +static PyObject *__pyx_n_s__b; +static PyObject *__pyx_n_s__c; static PyObject *__pyx_n_s__fT; static PyObject *__pyx_n_s__fX; static PyObject *__pyx_n_s__fY; static PyObject *__pyx_n_s__fZ; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; static PyObject *__pyx_n_s__t; static PyObject *__pyx_n_s__t0; static PyObject *__pyx_n_s__t1; -static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__va; static PyObject *__pyx_n_s__x; static PyObject *__pyx_n_s__x0; static PyObject *__pyx_n_s__x1; @@ -734,72 +1029,93 @@ static PyObject *__pyx_n_s__z; static PyObject *__pyx_n_s__z0; static PyObject *__pyx_n_s__z1; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":21 - * - * # Binded routines - * def array_get(A, size_t x, size_t y=0, size_t z=0, size_t t=0): # <<<<<<<<<<<<<< - * """ - * Get array element. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_22; +static PyObject *__pyx_k_codeobj_24; +static PyObject *__pyx_k_codeobj_26; +static PyObject *__pyx_k_codeobj_28; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_1array_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_4labs_8bindings_5array_array_get[] = "\n Get array element.\n va = array_get(A, size_t x, size_t y=0, size_t z=0, size_t t=0):\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_1array_get = {__Pyx_NAMESTR("array_get"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_1array_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_get)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_1array_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; size_t __pyx_v_x; size_t __pyx_v_y; size_t __pyx_v_z; size_t __pyx_v_t; - fff_array *__pyx_v_a; - double __pyx_v_va; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,&__pyx_n_s__t,0}; - __Pyx_RefNannySetupContext("array_get"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_get (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__x,&__pyx_n_s__y,&__pyx_n_s__z,&__pyx_n_s__t,0}; PyObject* values[5] = {0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_get", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); - if (unlikely(value)) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_get", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t); + if (value) { values[4] = value; kw_args--; } + } } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z); - if (unlikely(value)) { values[3] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t); - if (unlikely(value)) { values[4] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_A = values[0]; __pyx_v_x = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[2]) { @@ -817,33 +1133,40 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx } else { __pyx_v_t = ((size_t)0); } - } else { - __pyx_v_y = ((size_t)0); - __pyx_v_z = ((size_t)0); - __pyx_v_t = ((size_t)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_t = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_t == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_z = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_z == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_y = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_y == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_x = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_x == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_get", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_get"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_array_get(__pyx_self, __pyx_v_A, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":21 + * + * # Binded routines + * def array_get(A, size_t x, size_t y=0, size_t z=0, size_t t=0): # <<<<<<<<<<<<<< + * """ + * Get array element. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_x, size_t __pyx_v_y, size_t __pyx_v_z, size_t __pyx_v_t) { + fff_array *__pyx_v_a; + double __pyx_v_va; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_get", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":28 + /* "nipy/labs/bindings/array.pyx":28 * cdef fff_array* a * cdef double va * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -851,9 +1174,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx * fff_array_delete(a) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":29 + /* "nipy/labs/bindings/array.pyx":29 * cdef double va * a = fff_array_fromPyArray(A) * va = fff_array_get(a, x, y, z, t) # <<<<<<<<<<<<<< @@ -862,7 +1188,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx */ __pyx_v_va = fff_array_get(__pyx_v_a, __pyx_v_x, __pyx_v_y, __pyx_v_z, __pyx_v_t); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":30 + /* "nipy/labs/bindings/array.pyx":30 * a = fff_array_fromPyArray(A) * va = fff_array_get(a, x, y, z, t) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -871,7 +1197,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":31 + /* "nipy/labs/bindings/array.pyx":31 * va = fff_array_get(a, x, y, z, t) * fff_array_delete(a) * return va # <<<<<<<<<<<<<< @@ -889,7 +1215,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_get"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -897,17 +1223,11 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get(PyObject *__pyx return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":34 - * - * - * def array_get_block( A, size_t x0, size_t x1, size_t fX=1, # <<<<<<<<<<<<<< - * size_t y0=0, size_t y1=0, size_t fY=1, - * size_t z0=0, size_t z1=0, size_t fZ=1, - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_5array_array_get_block[] = "\n Get block\n Asub = array_get_block( A, size_t x0, size_t x1, size_t fX=1,\n size_t y0=0, size_t y1=0, size_t fY=1,\n size_t z0=0, size_t z1=0, size_t fZ=1,\n size_t t0=0, size_t t1=0, size_t fT=1 )\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_3array_get_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_5array_2array_get_block[] = "\n Get block\n Asub = array_get_block( A, size_t x0, size_t x1, size_t fX=1,\n size_t y0=0, size_t y1=0, size_t fY=1,\n size_t z0=0, size_t z1=0, size_t fZ=1,\n size_t t0=0, size_t t1=0, size_t fT=1 )\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_3array_get_block = {__Pyx_NAMESTR("array_get_block"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_3array_get_block, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_2array_get_block)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_3array_get_block(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; size_t __pyx_v_x0; size_t __pyx_v_x1; @@ -921,106 +1241,120 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject size_t __pyx_v_t0; size_t __pyx_v_t1; size_t __pyx_v_fT; - fff_array *__pyx_v_a; - fff_array *__pyx_v_b; - fff_array __pyx_v_asub; - PyObject *__pyx_v_B; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__x0,&__pyx_n_s__x1,&__pyx_n_s__fX,&__pyx_n_s__y0,&__pyx_n_s__y1,&__pyx_n_s__fY,&__pyx_n_s__z0,&__pyx_n_s__z1,&__pyx_n_s__fZ,&__pyx_n_s__t0,&__pyx_n_s__t1,&__pyx_n_s__fT,0}; - __Pyx_RefNannySetupContext("array_get_block"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_get_block (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__x0,&__pyx_n_s__x1,&__pyx_n_s__fX,&__pyx_n_s__y0,&__pyx_n_s__y1,&__pyx_n_s__fY,&__pyx_n_s__z0,&__pyx_n_s__z1,&__pyx_n_s__fZ,&__pyx_n_s__t0,&__pyx_n_s__t1,&__pyx_n_s__fT,0}; PyObject* values[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); - case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); - case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); - case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); - case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x0); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_get_block", 0, 3, 13, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x1); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_get_block", 0, 3, 13, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fX); - if (unlikely(value)) { values[3] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y0); - if (unlikely(value)) { values[4] = value; kw_args--; } - } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y1); - if (unlikely(value)) { values[5] = value; kw_args--; } - } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fY); - if (unlikely(value)) { values[6] = value; kw_args--; } - } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z0); - if (unlikely(value)) { values[7] = value; kw_args--; } - } - case 8: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z1); - if (unlikely(value)) { values[8] = value; kw_args--; } - } - case 9: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fZ); - if (unlikely(value)) { values[9] = value; kw_args--; } - } - case 10: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t0); - if (unlikely(value)) { values[10] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x0)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_get_block", 0, 3, 13, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_get_block", 0, 3, 13, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fX); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y0); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y1); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fY); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z0); + if (value) { values[7] = value; kw_args--; } + } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__z1); + if (value) { values[8] = value; kw_args--; } + } + case 9: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fZ); + if (value) { values[9] = value; kw_args--; } + } + case 10: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t0); + if (value) { values[10] = value; kw_args--; } + } + case 11: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t1); + if (value) { values[11] = value; kw_args--; } + } + case 12: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fT); + if (value) { values[12] = value; kw_args--; } + } } - case 11: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__t1); - if (unlikely(value)) { values[11] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_get_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 12: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fT); - if (unlikely(value)) { values[12] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 13: values[12] = PyTuple_GET_ITEM(__pyx_args, 12); + case 12: values[11] = PyTuple_GET_ITEM(__pyx_args, 11); + case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10); + case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9); + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_get_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_A = values[0]; __pyx_v_x0 = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_x0 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_x1 = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_x1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1074,56 +1408,42 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject } else { __pyx_v_fT = ((size_t)1); } - } else { - __pyx_v_fX = ((size_t)1); - __pyx_v_y0 = ((size_t)0); - __pyx_v_y1 = ((size_t)0); - __pyx_v_fY = ((size_t)1); - __pyx_v_z0 = ((size_t)0); - __pyx_v_z1 = ((size_t)0); - __pyx_v_fZ = ((size_t)1); - __pyx_v_t0 = ((size_t)0); - __pyx_v_t1 = ((size_t)0); - __pyx_v_fT = ((size_t)1); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 13: - __pyx_v_fT = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 12)); if (unlikely((__pyx_v_fT == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 12: - __pyx_v_t1 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 11)); if (unlikely((__pyx_v_t1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 11: - __pyx_v_t0 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 10)); if (unlikely((__pyx_v_t0 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 10: - __pyx_v_fZ = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 9)); if (unlikely((__pyx_v_fZ == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 9: - __pyx_v_z1 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 8)); if (unlikely((__pyx_v_z1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 8: - __pyx_v_z0 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_z0 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 7: - __pyx_v_fY = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_fY == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 6: - __pyx_v_y1 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_y1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_y0 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_y0 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_fX = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_fX == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_x1 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_x1 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_x0 = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_x0 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_get_block", 0, 3, 13, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_get_block"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_get_block", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_2array_get_block(__pyx_self, __pyx_v_A, __pyx_v_x0, __pyx_v_x1, __pyx_v_fX, __pyx_v_y0, __pyx_v_y1, __pyx_v_fY, __pyx_v_z0, __pyx_v_z1, __pyx_v_fZ, __pyx_v_t0, __pyx_v_t1, __pyx_v_fT); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":34 + * + * + * def array_get_block( A, size_t x0, size_t x1, size_t fX=1, # <<<<<<<<<<<<<< + * size_t y0=0, size_t y1=0, size_t fY=1, + * size_t z0=0, size_t z1=0, size_t fZ=1, + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_2array_get_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_x0, size_t __pyx_v_x1, size_t __pyx_v_fX, size_t __pyx_v_y0, size_t __pyx_v_y1, size_t __pyx_v_fY, size_t __pyx_v_z0, size_t __pyx_v_z1, size_t __pyx_v_fZ, size_t __pyx_v_t0, size_t __pyx_v_t1, size_t __pyx_v_fT) { + fff_array *__pyx_v_a; + fff_array *__pyx_v_b; + fff_array __pyx_v_asub; + PyArrayObject *__pyx_v_B = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_get_block", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":47 + /* "nipy/labs/bindings/array.pyx":47 * cdef fff_array *a, *b * cdef fff_array asub * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -1131,9 +1451,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject * b = fff_array_new(asub.datatype, asub.dimX, asub.dimY, asub.dimZ, asub.dimT) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":48 + /* "nipy/labs/bindings/array.pyx":48 * cdef fff_array asub * a = fff_array_fromPyArray(A) * asub = fff_array_get_block(a, x0, x1, fX, y0, y1, fY, z0, z1, fZ, t0, t1, fT) # <<<<<<<<<<<<<< @@ -1142,7 +1465,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject */ __pyx_v_asub = fff_array_get_block(__pyx_v_a, __pyx_v_x0, __pyx_v_x1, __pyx_v_fX, __pyx_v_y0, __pyx_v_y1, __pyx_v_fY, __pyx_v_z0, __pyx_v_z1, __pyx_v_fZ, __pyx_v_t0, __pyx_v_t1, __pyx_v_fT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":49 + /* "nipy/labs/bindings/array.pyx":49 * a = fff_array_fromPyArray(A) * asub = fff_array_get_block(a, x0, x1, fX, y0, y1, fY, z0, z1, fZ, t0, t1, fT) * b = fff_array_new(asub.datatype, asub.dimX, asub.dimY, asub.dimZ, asub.dimT) # <<<<<<<<<<<<<< @@ -1151,7 +1474,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject */ __pyx_v_b = fff_array_new(__pyx_v_asub.datatype, __pyx_v_asub.dimX, __pyx_v_asub.dimY, __pyx_v_asub.dimZ, __pyx_v_asub.dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":50 + /* "nipy/labs/bindings/array.pyx":50 * asub = fff_array_get_block(a, x0, x1, fX, y0, y1, fY, z0, z1, fZ, t0, t1, fT) * b = fff_array_new(asub.datatype, asub.dimX, asub.dimY, asub.dimZ, asub.dimT) * fff_array_copy(b, &asub) # <<<<<<<<<<<<<< @@ -1160,7 +1483,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject */ fff_array_copy(__pyx_v_b, (&__pyx_v_asub)); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":51 + /* "nipy/labs/bindings/array.pyx":51 * b = fff_array_new(asub.datatype, asub.dimX, asub.dimY, asub.dimZ, asub.dimT) * fff_array_copy(b, &asub) * B = fff_array_toPyArray(b) # <<<<<<<<<<<<<< @@ -1169,11 +1492,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject */ __pyx_t_1 = ((PyObject *)fff_array_toPyArray(__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_1; + __pyx_v_B = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":52 + /* "nipy/labs/bindings/array.pyx":52 * fff_array_copy(b, &asub) * B = fff_array_toPyArray(b) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -1182,7 +1504,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":53 + /* "nipy/labs/bindings/array.pyx":53 * B = fff_array_toPyArray(b) * fff_array_delete(a) * return B # <<<<<<<<<<<<<< @@ -1190,87 +1512,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block(PyObject * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_B); - __pyx_r = __pyx_v_B; + __Pyx_INCREF(((PyObject *)__pyx_v_B)); + __pyx_r = ((PyObject *)__pyx_v_B); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_get_block"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_get_block", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_B); + __Pyx_XDECREF((PyObject *)__pyx_v_B); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":56 - * - * - * def array_add(A, B): # <<<<<<<<<<<<<< - * """ - * C = A + B - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_5array_array_add[] = "\n C = A + B \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_5array_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_5array_4array_add[] = "\n C = A + B \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_5array_add = {__Pyx_NAMESTR("array_add"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_5array_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_4array_add)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_5array_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_array *__pyx_v_a; - fff_array *__pyx_v_b; - fff_array *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("array_add"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_A = values[0]; __pyx_v_B = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_add"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_4array_add(__pyx_self, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":56 + * + * + * def array_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = A + B + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_4array_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_array *__pyx_v_a; + fff_array *__pyx_v_b; + fff_array *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_add", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":62 + /* "nipy/labs/bindings/array.pyx":62 * cdef fff_array *a, *b, *c * * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -1278,9 +1616,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":63 + /* "nipy/labs/bindings/array.pyx":63 * * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) # <<<<<<<<<<<<<< @@ -1288,9 +1629,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx * fff_array_copy(c, a) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":64 + /* "nipy/labs/bindings/array.pyx":64 * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) # <<<<<<<<<<<<<< @@ -1299,7 +1643,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ __pyx_v_c = fff_array_new(__pyx_v_a->datatype, __pyx_v_a->dimX, __pyx_v_a->dimY, __pyx_v_a->dimZ, __pyx_v_a->dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":65 + /* "nipy/labs/bindings/array.pyx":65 * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) # <<<<<<<<<<<<<< @@ -1308,7 +1652,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ fff_array_copy(__pyx_v_c, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":66 + /* "nipy/labs/bindings/array.pyx":66 * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) * fff_array_add(c, b) # <<<<<<<<<<<<<< @@ -1317,7 +1661,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ fff_array_add(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":67 + /* "nipy/labs/bindings/array.pyx":67 * fff_array_copy(c, a) * fff_array_add(c, b) * C = fff_array_toPyArray(c) # <<<<<<<<<<<<<< @@ -1326,11 +1670,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ __pyx_t_1 = ((PyObject *)fff_array_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":68 + /* "nipy/labs/bindings/array.pyx":68 * fff_array_add(c, b) * C = fff_array_toPyArray(c) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -1339,7 +1682,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":69 + /* "nipy/labs/bindings/array.pyx":69 * C = fff_array_toPyArray(c) * fff_array_delete(a) * fff_array_delete(b) # <<<<<<<<<<<<<< @@ -1348,7 +1691,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx */ fff_array_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":70 + /* "nipy/labs/bindings/array.pyx":70 * fff_array_delete(a) * fff_array_delete(b) * return C # <<<<<<<<<<<<<< @@ -1356,87 +1699,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_add(PyObject *__pyx * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_add"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":73 - * - * - * def array_mul(A, B): # <<<<<<<<<<<<<< - * """ - * C = A * B - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_5array_array_mul[] = "\n C = A * B \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_7array_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_5array_6array_mul[] = "\n C = A * B \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_7array_mul = {__Pyx_NAMESTR("array_mul"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_7array_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_6array_mul)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_7array_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_array *__pyx_v_a; - fff_array *__pyx_v_b; - fff_array *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("array_mul"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_mul (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_mul", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_mul", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_A = values[0]; __pyx_v_B = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_mul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_mul"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_mul", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_6array_mul(__pyx_self, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":73 + * + * + * def array_mul(A, B): # <<<<<<<<<<<<<< + * """ + * C = A * B + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_6array_mul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_array *__pyx_v_a; + fff_array *__pyx_v_b; + fff_array *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_mul", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":79 + /* "nipy/labs/bindings/array.pyx":79 * cdef fff_array *a, *b, *c * * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -1444,9 +1803,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":80 + /* "nipy/labs/bindings/array.pyx":80 * * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) # <<<<<<<<<<<<<< @@ -1454,9 +1816,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx * fff_array_copy(c, a) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":81 + /* "nipy/labs/bindings/array.pyx":81 * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) # <<<<<<<<<<<<<< @@ -1465,7 +1830,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ __pyx_v_c = fff_array_new(__pyx_v_a->datatype, __pyx_v_a->dimX, __pyx_v_a->dimY, __pyx_v_a->dimZ, __pyx_v_a->dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":82 + /* "nipy/labs/bindings/array.pyx":82 * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) # <<<<<<<<<<<<<< @@ -1474,7 +1839,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ fff_array_copy(__pyx_v_c, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":83 + /* "nipy/labs/bindings/array.pyx":83 * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) * fff_array_mul(c, b) # <<<<<<<<<<<<<< @@ -1483,7 +1848,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ fff_array_mul(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":84 + /* "nipy/labs/bindings/array.pyx":84 * fff_array_copy(c, a) * fff_array_mul(c, b) * C = fff_array_toPyArray(c) # <<<<<<<<<<<<<< @@ -1492,11 +1857,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ __pyx_t_1 = ((PyObject *)fff_array_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":85 + /* "nipy/labs/bindings/array.pyx":85 * fff_array_mul(c, b) * C = fff_array_toPyArray(c) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -1505,7 +1869,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":86 + /* "nipy/labs/bindings/array.pyx":86 * C = fff_array_toPyArray(c) * fff_array_delete(a) * fff_array_delete(b) # <<<<<<<<<<<<<< @@ -1514,7 +1878,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx */ fff_array_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":87 + /* "nipy/labs/bindings/array.pyx":87 * fff_array_delete(a) * fff_array_delete(b) * return C # <<<<<<<<<<<<<< @@ -1522,87 +1886,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_mul(PyObject *__pyx * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_mul"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_mul", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":90 - * - * - * def array_sub(A, B): # <<<<<<<<<<<<<< - * """ - * C = A - B - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_5array_array_sub[] = "\n C = A - B \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_9array_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_5array_8array_sub[] = "\n C = A - B \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_9array_sub = {__Pyx_NAMESTR("array_sub"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_9array_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_8array_sub)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_9array_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_array *__pyx_v_a; - fff_array *__pyx_v_b; - fff_array *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("array_sub"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_sub (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_sub", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_sub", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_A = values[0]; __pyx_v_B = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_sub", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_sub"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_sub", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_8array_sub(__pyx_self, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":90 + * + * + * def array_sub(A, B): # <<<<<<<<<<<<<< + * """ + * C = A - B + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_8array_sub(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_array *__pyx_v_a; + fff_array *__pyx_v_b; + fff_array *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_sub", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":96 + /* "nipy/labs/bindings/array.pyx":96 * cdef fff_array *a, *b, *c * * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -1610,9 +1990,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":97 + /* "nipy/labs/bindings/array.pyx":97 * * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) # <<<<<<<<<<<<<< @@ -1620,9 +2003,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx * fff_array_copy(c, a) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":98 + /* "nipy/labs/bindings/array.pyx":98 * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) # <<<<<<<<<<<<<< @@ -1631,7 +2017,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ __pyx_v_c = fff_array_new(__pyx_v_a->datatype, __pyx_v_a->dimX, __pyx_v_a->dimY, __pyx_v_a->dimZ, __pyx_v_a->dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":99 + /* "nipy/labs/bindings/array.pyx":99 * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) # <<<<<<<<<<<<<< @@ -1640,7 +2026,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ fff_array_copy(__pyx_v_c, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":100 + /* "nipy/labs/bindings/array.pyx":100 * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) * fff_array_sub(c, b) # <<<<<<<<<<<<<< @@ -1649,7 +2035,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ fff_array_sub(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":101 + /* "nipy/labs/bindings/array.pyx":101 * fff_array_copy(c, a) * fff_array_sub(c, b) * C = fff_array_toPyArray(c) # <<<<<<<<<<<<<< @@ -1658,11 +2044,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ __pyx_t_1 = ((PyObject *)fff_array_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":102 + /* "nipy/labs/bindings/array.pyx":102 * fff_array_sub(c, b) * C = fff_array_toPyArray(c) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -1671,7 +2056,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":103 + /* "nipy/labs/bindings/array.pyx":103 * C = fff_array_toPyArray(c) * fff_array_delete(a) * fff_array_delete(b) # <<<<<<<<<<<<<< @@ -1680,7 +2065,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx */ fff_array_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":104 + /* "nipy/labs/bindings/array.pyx":104 * fff_array_delete(a) * fff_array_delete(b) * return C # <<<<<<<<<<<<<< @@ -1688,87 +2073,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_sub(PyObject *__pyx * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_sub"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_sub", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":107 - * - * - * def array_div(A, B): # <<<<<<<<<<<<<< - * """ - * C = A / B - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_5array_array_div[] = "\n C = A / B \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_11array_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_5array_10array_div[] = "\n C = A / B \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_5array_11array_div = {__Pyx_NAMESTR("array_div"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_5array_11array_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_10array_div)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_5array_11array_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_array *__pyx_v_a; - fff_array *__pyx_v_b; - fff_array *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("array_div"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("array_div (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("array_div", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("array_div", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "array_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_A = values[0]; __pyx_v_B = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("array_div", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.array.array_div"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_div", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_5array_10array_div(__pyx_self, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/array.pyx":107 + * + * + * def array_div(A, B): # <<<<<<<<<<<<<< + * """ + * C = A / B + */ - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":113 +static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_10array_div(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_array *__pyx_v_a; + fff_array *__pyx_v_b; + fff_array *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("array_div", 0); + + /* "nipy/labs/bindings/array.pyx":113 * cdef fff_array *a, *b, *c * * a = fff_array_fromPyArray(A) # <<<<<<<<<<<<<< @@ -1776,9 +2177,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":114 + /* "nipy/labs/bindings/array.pyx":114 * * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) # <<<<<<<<<<<<<< @@ -1786,9 +2190,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx * fff_array_copy(c, a) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_array_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":115 + /* "nipy/labs/bindings/array.pyx":115 * a = fff_array_fromPyArray(A) * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) # <<<<<<<<<<<<<< @@ -1797,7 +2204,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ __pyx_v_c = fff_array_new(__pyx_v_a->datatype, __pyx_v_a->dimX, __pyx_v_a->dimY, __pyx_v_a->dimZ, __pyx_v_a->dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":116 + /* "nipy/labs/bindings/array.pyx":116 * b = fff_array_fromPyArray(B) * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) # <<<<<<<<<<<<<< @@ -1806,7 +2213,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ fff_array_copy(__pyx_v_c, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":117 + /* "nipy/labs/bindings/array.pyx":117 * c = fff_array_new(a.datatype, a.dimX, a.dimY, a.dimZ, a.dimT) * fff_array_copy(c, a) * fff_array_div(c, b) # <<<<<<<<<<<<<< @@ -1815,7 +2222,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ fff_array_div(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":118 + /* "nipy/labs/bindings/array.pyx":118 * fff_array_copy(c, a) * fff_array_div(c, b) * C = fff_array_toPyArray(c) # <<<<<<<<<<<<<< @@ -1824,11 +2231,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ __pyx_t_1 = ((PyObject *)fff_array_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":119 + /* "nipy/labs/bindings/array.pyx":119 * fff_array_div(c, b) * C = fff_array_toPyArray(c) * fff_array_delete(a) # <<<<<<<<<<<<<< @@ -1837,7 +2243,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ fff_array_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":120 + /* "nipy/labs/bindings/array.pyx":120 * C = fff_array_toPyArray(c) * fff_array_delete(a) * fff_array_delete(b) # <<<<<<<<<<<<<< @@ -1845,30 +2251,41 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx */ fff_array_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":121 + /* "nipy/labs/bindings/array.pyx":121 * fff_array_delete(a) * fff_array_delete(b) * return C # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.array.array_div"); + __Pyx_AddTraceback("nipy.labs.bindings.array.array_div", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1876,8 +2293,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_5array_array_div(PyObject *__pyx * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -1889,23 +2305,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -1913,7 +2348,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1922,16 +2357,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1941,7 +2376,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1949,11 +2384,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1962,9 +2397,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1974,43 +2409,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2020,142 +2449,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2164,25 +2586,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2191,17 +2613,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2210,7 +2634,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2226,7 +2650,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2238,49 +2662,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2291,50 +2716,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2343,10 +2762,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2356,10 +2775,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2369,10 +2788,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2382,10 +2801,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2395,10 +2814,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2408,10 +2827,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2421,10 +2840,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2434,10 +2853,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2447,10 +2866,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2460,10 +2879,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2473,10 +2892,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2486,10 +2905,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2499,10 +2918,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2512,10 +2931,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2525,10 +2944,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2538,10 +2957,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2551,37 +2970,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2590,7 +3009,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2599,105 +3018,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2705,11 +3133,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2719,7 +3147,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2727,15 +3155,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2745,10 +3172,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2756,7 +3187,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2766,7 +3197,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2774,7 +3205,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2784,10 +3215,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2795,7 +3230,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2805,7 +3240,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2813,7 +3248,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2823,10 +3258,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2834,7 +3273,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2844,7 +3283,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2852,7 +3291,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2862,10 +3301,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2873,7 +3316,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2883,7 +3326,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2891,7 +3334,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2901,10 +3344,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2912,7 +3359,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2922,7 +3369,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2930,7 +3377,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2939,33 +3386,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2974,7 +3421,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2983,167 +3430,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3151,16 +3625,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3169,469 +3642,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3644,24 +4096,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3671,12 +4122,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3686,7 +4136,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3698,7 +4148,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3707,7 +4157,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3718,7 +4168,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3727,7 +4177,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3736,12 +4186,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3751,11 +4199,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3765,7 +4213,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3780,7 +4228,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3794,29 +4242,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("array_get"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_get)}, - {__Pyx_NAMESTR("array_get_block"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_get_block, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_get_block)}, - {__Pyx_NAMESTR("array_add"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_add)}, - {__Pyx_NAMESTR("array_mul"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_mul)}, - {__Pyx_NAMESTR("array_sub"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_sub)}, - {__Pyx_NAMESTR("array_div"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_5array_array_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_5array_array_div)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("array"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3828,48 +4267,43 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, + {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__datatype, __pyx_k__datatype, sizeof(__pyx_k__datatype), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__dimT, __pyx_k__dimT, sizeof(__pyx_k__dimT), 0, 0, 1, 1}, - {&__pyx_n_s__dimX, __pyx_k__dimX, sizeof(__pyx_k__dimX), 0, 0, 1, 1}, - {&__pyx_n_s__dimY, __pyx_k__dimY, sizeof(__pyx_k__dimY), 0, 0, 1, 1}, - {&__pyx_n_s__dimZ, __pyx_k__dimZ, sizeof(__pyx_k__dimZ), 0, 0, 1, 1}, + {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__array_add, __pyx_k__array_add, sizeof(__pyx_k__array_add), 0, 0, 1, 1}, + {&__pyx_n_s__array_div, __pyx_k__array_div, sizeof(__pyx_k__array_div), 0, 0, 1, 1}, + {&__pyx_n_s__array_get, __pyx_k__array_get, sizeof(__pyx_k__array_get), 0, 0, 1, 1}, + {&__pyx_n_s__array_get_block, __pyx_k__array_get_block, sizeof(__pyx_k__array_get_block), 0, 0, 1, 1}, + {&__pyx_n_s__array_mul, __pyx_k__array_mul, sizeof(__pyx_k__array_mul), 0, 0, 1, 1}, + {&__pyx_n_s__array_sub, __pyx_k__array_sub, sizeof(__pyx_k__array_sub), 0, 0, 1, 1}, + {&__pyx_n_s__asub, __pyx_k__asub, sizeof(__pyx_k__asub), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, {&__pyx_n_s__fT, __pyx_k__fT, sizeof(__pyx_k__fT), 0, 0, 1, 1}, {&__pyx_n_s__fX, __pyx_k__fX, sizeof(__pyx_k__fX), 0, 0, 1, 1}, {&__pyx_n_s__fY, __pyx_k__fY, sizeof(__pyx_k__fY), 0, 0, 1, 1}, {&__pyx_n_s__fZ, __pyx_k__fZ, sizeof(__pyx_k__fZ), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, {&__pyx_n_s__t0, __pyx_k__t0, sizeof(__pyx_k__t0), 0, 0, 1, 1}, {&__pyx_n_s__t1, __pyx_k__t1, sizeof(__pyx_k__t1), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__va, __pyx_k__va, sizeof(__pyx_k__va), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {&__pyx_n_s__x0, __pyx_k__x0, sizeof(__pyx_k__x0), 0, 0, 1, 1}, {&__pyx_n_s__x1, __pyx_k__x1, sizeof(__pyx_k__x1), 0, 0, 1, 1}, @@ -3882,14 +4316,324 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/bindings/array.pyx":21 + * + * # Binded routines + * def array_get(A, size_t x, size_t y=0, size_t z=0, size_t t=0): # <<<<<<<<<<<<<< + * """ + * Get array element. + */ + __pyx_k_tuple_15 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__va)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 6, ((PyObject *)__pyx_n_s__va)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__va)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(5, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_get, 21, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/array.pyx":34 + * + * + * def array_get_block( A, size_t x0, size_t x1, size_t fX=1, # <<<<<<<<<<<<<< + * size_t y0=0, size_t y1=0, size_t fY=1, + * size_t z0=0, size_t z1=0, size_t fZ=1, + */ + __pyx_k_tuple_19 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x0)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__x0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__x1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fX)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__fX)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fX)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y0)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__y0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__y1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fY)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__fY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fY)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z0)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__z0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__z1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fZ)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__fZ)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fZ)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t0)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__t0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__t1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fT)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__fT)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fT)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__asub)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__asub)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asub)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(13, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_get_block, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/array.pyx":56 + * + * + * def array_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = A + B + */ + __pyx_k_tuple_21 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_add, 56, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/array.pyx":73 + * + * + * def array_mul(A, B): # <<<<<<<<<<<<<< + * """ + * C = A * B + */ + __pyx_k_tuple_23 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_mul, 73, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/array.pyx":90 + * + * + * def array_sub(A, B): # <<<<<<<<<<<<<< + * """ + * C = A - B + */ + __pyx_k_tuple_25 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 3, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 4, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_sub, 90, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/array.pyx":107 + * + * + * def array_div(A, B): # <<<<<<<<<<<<<< + * """ + * C = A / B + */ + __pyx_k_tuple_27 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 3, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 4, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_k_codeobj_28 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__array_div, 107, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; @@ -3907,8 +4651,8 @@ PyMODINIT_FUNC PyInit_array(void) #endif { PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -3916,14 +4660,19 @@ PyMODINIT_FUNC PyInit_array(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_array(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_array(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3934,16 +4683,23 @@ PyMODINIT_FUNC PyInit_array(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("array"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("array"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.bindings.array")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.bindings.array", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3952,28 +4708,39 @@ PyMODINIT_FUNC PyInit_array(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":10 + /* "nipy/labs/bindings/array.pyx":10 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * # Includes */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":16 + /* "nipy/labs/bindings/array.pyx":16 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -3982,7 +4749,7 @@ PyMODINIT_FUNC PyInit_array(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":17 + /* "nipy/labs/bindings/array.pyx":17 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -3991,28 +4758,112 @@ PyMODINIT_FUNC PyInit_array(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/array.pyx":18 + /* "nipy/labs/bindings/array.pyx":18 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * # Binded routines */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/bindings/array.pyx":21 + * + * # Binded routines + * def array_get(A, size_t x, size_t y=0, size_t z=0, size_t t=0): # <<<<<<<<<<<<<< + * """ + * Get array element. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_1array_get, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_get, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":34 + * + * + * def array_get_block( A, size_t x0, size_t x1, size_t fX=1, # <<<<<<<<<<<<<< + * size_t y0=0, size_t y1=0, size_t fY=1, + * size_t z0=0, size_t z1=0, size_t fZ=1, + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_3array_get_block, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_get_block, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":56 + * + * + * def array_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = A + B + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_5array_add, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_add, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":73 + * + * + * def array_mul(A, B): # <<<<<<<<<<<<<< + * """ + * C = A * B + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_7array_mul, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_mul, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":90 + * + * + * def array_sub(A, B): # <<<<<<<<<<<<<< + * """ + * C = A - B + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_9array_sub, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_sub, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":107 + * + * + * def array_div(A, B): # <<<<<<<<<<<<<< + * """ + * C = A / B + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_5array_11array_div, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__array_div, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/array.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.bindings.array"); + __Pyx_AddTraceback("init nipy.labs.bindings.array", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.bindings.array"); @@ -4026,29 +4877,22 @@ PyMODINIT_FUNC PyInit_array(void) #endif } -static const char *__pyx_filenames[] = { - "array.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; -} - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -4058,8 +4902,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4070,14 +4913,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -4092,55 +4944,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4171,66 +5045,271 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif } - return item; + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(); + return __Pyx_IterFinish(); } + return 0; } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -4246,11 +5325,47 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } @@ -4319,15 +5434,60 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4394,160 +5554,60 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -4721,6 +5781,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -4742,9 +5821,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -4777,9 +5856,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -4812,9 +5891,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -4847,9 +5926,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -4882,9 +5961,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -4917,9 +5996,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -4931,24 +6010,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -4959,19 +6069,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -4980,54 +6094,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5038,28 +6207,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5067,11 +6253,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5106,11 +6290,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/bindings/linalg.c b/nipy/labs/bindings/linalg.c index f69bc6157e..ccd8c95cd7 100644 --- a/nipy/labs/bindings/linalg.c +++ b/nipy/labs/bindings/linalg.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:43:38 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:33 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__bindings__linalg #define __PYX_HAVE_API__nipy__labs__bindings__linalg -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -163,120 +261,79 @@ #include "fff_array.h" #include "fffpy.h" #include "fff_blas.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -287,8 +344,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -299,7 +354,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -307,52 +361,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "linalg.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -373,20 +590,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -397,60 +641,76 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -464,7 +724,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -485,11 +744,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -500,7 +765,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -515,11 +783,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -530,16 +804,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -558,6 +828,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -570,42 +842,68 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ -/* Module declarations from stdio */ +/* Module declarations from 'libc.stdio' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.bindings.linalg */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.bindings.linalg' */ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(int); /*proto*/ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int); /*proto*/ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int); /*proto*/ @@ -613,21 +911,54 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int); /*prot #define __Pyx_MODULE_NAME "nipy.labs.bindings.linalg" int __pyx_module_is_main_nipy__labs__bindings__linalg = 0; -/* Implementation of nipy.labs.bindings.linalg */ +/* Implementation of 'nipy.labs.bindings.linalg' */ static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, size_t __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_2vector_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, size_t __pyx_v_i, double __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_4vector_set_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_6vector_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_8vector_add_constant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_10vector_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_12vector_sub(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_14vector_mul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_16vector_div(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_18vector_sum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_20vector_ssd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_m, int __pyx_v_fixed); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_22vector_sad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_m); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_24vector_median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_26vector_quantile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_r, int __pyx_v_interp); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_28matrix_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_i, size_t __pyx_v_j); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_30matrix_transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_32matrix_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_34blas_dnrm2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_36blas_dasum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_38blas_ddot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_40blas_daxpy(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_alpha, PyObject *__pyx_v_X, PyObject *__pyx_v_Y); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_42blas_dscal(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_alpha, PyObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_44blas_dgemm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_TransA, int __pyx_v_TransB, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, double __pyx_v_beta, PyObject *__pyx_v_C); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_46blas_dsymm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_beta, PyObject *__pyx_v_C); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_48blas_dtrmm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, int __pyx_v_TransA, int __pyx_v_Diag, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_50blas_dtrsm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, int __pyx_v_TransA, int __pyx_v_Diag, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_52blas_dsyrk(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Uplo, int __pyx_v_Trans, double __pyx_v_alpha, PyObject *__pyx_v_A, double __pyx_v_beta, PyObject *__pyx_v_C); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_54blas_dsyr2k(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Uplo, int __pyx_v_Trans, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, double __pyx_v_beta, PyObject *__pyx_v_C); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nPython access to core fff functions written in C. This module is\nmainly used for unitary tests.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nPython access to core fff functions written in C. This module is\nmainly used for unitary tests.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/bindings/linalg.pyx"; +static char __pyx_k_18[] = "nipy.labs.bindings.linalg"; static char __pyx_k__A[] = "A"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; +static char __pyx_k__D[] = "D"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; @@ -635,8 +966,10 @@ static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__X[] = "X"; static char __pyx_k__Y[] = "Y"; +static char __pyx_k__Z[] = "Z"; static char __pyx_k__a[] = "a"; static char __pyx_k__b[] = "b"; +static char __pyx_k__c[] = "c"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; @@ -647,54 +980,74 @@ static char __pyx_k__l[] = "l"; static char __pyx_k__m[] = "m"; static char __pyx_k__q[] = "q"; static char __pyx_k__r[] = "r"; +static char __pyx_k__s[] = "s"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__xi[] = "xi"; +static char __pyx_k__aij[] = "aij"; static char __pyx_k__Diag[] = "Diag"; static char __pyx_k__Side[] = "Side"; static char __pyx_k__Uplo[] = "Uplo"; -static char __pyx_k__base[] = "base"; static char __pyx_k__beta[] = "beta"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__size[] = "size"; static char __pyx_k__Trans[] = "Trans"; static char __pyx_k__alpha[] = "alpha"; -static char __pyx_k__descr[] = "descr"; static char __pyx_k__fixed[] = "fixed"; -static char __pyx_k__names[] = "names"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__size1[] = "size1"; -static char __pyx_k__size2[] = "size2"; static char __pyx_k__TransA[] = "TransA"; static char __pyx_k__TransB[] = "TransB"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; static char __pyx_k__interp[] = "interp"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__blas_ddot[] = "blas_ddot"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__blas_dasum[] = "blas_dasum"; +static char __pyx_k__blas_daxpy[] = "blas_daxpy"; +static char __pyx_k__blas_dgemm[] = "blas_dgemm"; +static char __pyx_k__blas_dnrm2[] = "blas_dnrm2"; +static char __pyx_k__blas_dscal[] = "blas_dscal"; +static char __pyx_k__blas_dsymm[] = "blas_dsymm"; +static char __pyx_k__blas_dsyrk[] = "blas_dsyrk"; +static char __pyx_k__blas_dtrmm[] = "blas_dtrmm"; +static char __pyx_k__blas_dtrsm[] = "blas_dtrsm"; +static char __pyx_k__matrix_add[] = "matrix_add"; +static char __pyx_k__matrix_get[] = "matrix_get"; +static char __pyx_k__vector_add[] = "vector_add"; +static char __pyx_k__vector_div[] = "vector_div"; +static char __pyx_k__vector_get[] = "vector_get"; +static char __pyx_k__vector_mul[] = "vector_mul"; +static char __pyx_k__vector_sad[] = "vector_sad"; +static char __pyx_k__vector_set[] = "vector_set"; +static char __pyx_k__vector_ssd[] = "vector_ssd"; +static char __pyx_k__vector_sub[] = "vector_sub"; +static char __pyx_k__vector_sum[] = "vector_sum"; static char __pyx_k____version__[] = "__version__"; +static char __pyx_k__blas_dsyr2k[] = "blas_dsyr2k"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__vector_scale[] = "vector_scale"; +static char __pyx_k__vector_median[] = "vector_median"; +static char __pyx_k__vector_set_all[] = "vector_set_all"; +static char __pyx_k__vector_quantile[] = "vector_quantile"; +static char __pyx_k__matrix_transpose[] = "matrix_transpose"; +static char __pyx_k__vector_add_constant[] = "vector_add_constant"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__A; static PyObject *__pyx_n_s__B; static PyObject *__pyx_n_s__C; +static PyObject *__pyx_n_s__D; static PyObject *__pyx_n_s__Diag; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__Side; @@ -705,111 +1058,215 @@ static PyObject *__pyx_n_s__Uplo; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; static PyObject *__pyx_n_s__Y; +static PyObject *__pyx_n_s__Z; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__aij; static PyObject *__pyx_n_s__alpha; -static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__b; static PyObject *__pyx_n_s__beta; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__blas_dasum; +static PyObject *__pyx_n_s__blas_daxpy; +static PyObject *__pyx_n_s__blas_ddot; +static PyObject *__pyx_n_s__blas_dgemm; +static PyObject *__pyx_n_s__blas_dnrm2; +static PyObject *__pyx_n_s__blas_dscal; +static PyObject *__pyx_n_s__blas_dsymm; +static PyObject *__pyx_n_s__blas_dsyr2k; +static PyObject *__pyx_n_s__blas_dsyrk; +static PyObject *__pyx_n_s__blas_dtrmm; +static PyObject *__pyx_n_s__blas_dtrsm; +static PyObject *__pyx_n_s__c; +static PyObject *__pyx_n_s__d; static PyObject *__pyx_n_s__fixed; -static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__interp; -static PyObject *__pyx_n_s__itemsize; static PyObject *__pyx_n_s__j; static PyObject *__pyx_n_s__m; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__matrix_add; +static PyObject *__pyx_n_s__matrix_get; +static PyObject *__pyx_n_s__matrix_transpose; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__q; static PyObject *__pyx_n_s__r; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__size1; -static PyObject *__pyx_n_s__size2; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__s; +static PyObject *__pyx_n_s__vector_add; +static PyObject *__pyx_n_s__vector_add_constant; +static PyObject *__pyx_n_s__vector_div; +static PyObject *__pyx_n_s__vector_get; +static PyObject *__pyx_n_s__vector_median; +static PyObject *__pyx_n_s__vector_mul; +static PyObject *__pyx_n_s__vector_quantile; +static PyObject *__pyx_n_s__vector_sad; +static PyObject *__pyx_n_s__vector_scale; +static PyObject *__pyx_n_s__vector_set; +static PyObject *__pyx_n_s__vector_set_all; +static PyObject *__pyx_n_s__vector_ssd; +static PyObject *__pyx_n_s__vector_sub; +static PyObject *__pyx_n_s__vector_sum; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__xi; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__z; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":91 - * - * ## fff_vector.h - * def vector_get(X, size_t i): # <<<<<<<<<<<<<< - * """ - * Get i-th element. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_29; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_33; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_37; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_41; +static PyObject *__pyx_k_tuple_43; +static PyObject *__pyx_k_tuple_45; +static PyObject *__pyx_k_tuple_47; +static PyObject *__pyx_k_tuple_49; +static PyObject *__pyx_k_tuple_51; +static PyObject *__pyx_k_tuple_53; +static PyObject *__pyx_k_tuple_55; +static PyObject *__pyx_k_tuple_57; +static PyObject *__pyx_k_tuple_59; +static PyObject *__pyx_k_tuple_61; +static PyObject *__pyx_k_tuple_63; +static PyObject *__pyx_k_tuple_65; +static PyObject *__pyx_k_tuple_67; +static PyObject *__pyx_k_tuple_69; +static PyObject *__pyx_k_tuple_71; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_22; +static PyObject *__pyx_k_codeobj_24; +static PyObject *__pyx_k_codeobj_26; +static PyObject *__pyx_k_codeobj_28; +static PyObject *__pyx_k_codeobj_30; +static PyObject *__pyx_k_codeobj_32; +static PyObject *__pyx_k_codeobj_34; +static PyObject *__pyx_k_codeobj_36; +static PyObject *__pyx_k_codeobj_38; +static PyObject *__pyx_k_codeobj_40; +static PyObject *__pyx_k_codeobj_42; +static PyObject *__pyx_k_codeobj_44; +static PyObject *__pyx_k_codeobj_46; +static PyObject *__pyx_k_codeobj_48; +static PyObject *__pyx_k_codeobj_50; +static PyObject *__pyx_k_codeobj_52; +static PyObject *__pyx_k_codeobj_54; +static PyObject *__pyx_k_codeobj_56; +static PyObject *__pyx_k_codeobj_58; +static PyObject *__pyx_k_codeobj_60; +static PyObject *__pyx_k_codeobj_62; +static PyObject *__pyx_k_codeobj_64; +static PyObject *__pyx_k_codeobj_66; +static PyObject *__pyx_k_codeobj_68; +static PyObject *__pyx_k_codeobj_70; +static PyObject *__pyx_k_codeobj_72; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_1vector_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_get[] = "\n Get i-th element.\n xi = vector_get(x, i)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_1vector_get = {__Pyx_NAMESTR("vector_get"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_1vector_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_get)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_1vector_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; size_t __pyx_v_i; - fff_vector *__pyx_v_x; - double __pyx_v_xi; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__i,0}; - __Pyx_RefNannySetupContext("vector_get"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_get (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__i,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_get", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_get", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_i = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_i = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_get", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_get"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":98 - * cdef fff_vector* x + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(__pyx_self, __pyx_v_X, __pyx_v_i); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":91 + * + * ## fff_vector.h + * def vector_get(X, size_t i): # <<<<<<<<<<<<<< + * """ + * Get i-th element. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, size_t __pyx_v_i) { + fff_vector *__pyx_v_x; + double __pyx_v_xi; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_get", 0); + + /* "nipy/labs/bindings/linalg.pyx":98 + * cdef fff_vector* x * cdef double xi * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< * xi = fff_vector_get(x, i) * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":99 + /* "nipy/labs/bindings/linalg.pyx":99 * cdef double xi * x = fff_vector_fromPyArray(X) * xi = fff_vector_get(x, i) # <<<<<<<<<<<<<< @@ -818,7 +1275,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__p */ __pyx_v_xi = fff_vector_get(__pyx_v_x, __pyx_v_i); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":100 + /* "nipy/labs/bindings/linalg.pyx":100 * x = fff_vector_fromPyArray(X) * xi = fff_vector_get(x, i) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -827,7 +1284,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":101 + /* "nipy/labs/bindings/linalg.pyx":101 * xi = fff_vector_get(x, i) * fff_vector_delete(x) * return xi # <<<<<<<<<<<<<< @@ -845,7 +1302,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_get"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -853,79 +1310,94 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":103 - * return xi - * - * def vector_set(X, size_t i, double a): # <<<<<<<<<<<<<< - * """ - * Set i-th element. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_set[] = "\n Set i-th element.\n vector_set(x, i, a)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_3vector_set(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_2vector_set[] = "\n Set i-th element.\n vector_set(x, i, a)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_3vector_set = {__Pyx_NAMESTR("vector_set"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_3vector_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_2vector_set)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_3vector_set(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; size_t __pyx_v_i; double __pyx_v_a; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_v_Y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__i,&__pyx_n_s__a,0}; - __Pyx_RefNannySetupContext("vector_set"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_set (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__i,&__pyx_n_s__a,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_set", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_set", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_set", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_set", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_X = values[0]; __pyx_v_i = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_a = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_i = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_a = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_set", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Y = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_2vector_set(__pyx_self, __pyx_v_X, __pyx_v_i, __pyx_v_a); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":103 + * return xi + * + * def vector_set(X, size_t i, double a): # <<<<<<<<<<<<<< + * """ + * Set i-th element. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_2vector_set(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, size_t __pyx_v_i, double __pyx_v_a) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyArrayObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_set", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":109 + /* "nipy/labs/bindings/linalg.pyx":109 * """ * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -933,9 +1405,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p * fff_vector_memcpy(y, x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":110 + /* "nipy/labs/bindings/linalg.pyx":110 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -944,7 +1419,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":111 + /* "nipy/labs/bindings/linalg.pyx":111 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -953,7 +1428,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":112 + /* "nipy/labs/bindings/linalg.pyx":112 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_vector_set(y, i, a) # <<<<<<<<<<<<<< @@ -962,7 +1437,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p */ fff_vector_set(__pyx_v_y, __pyx_v_i, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":113 + /* "nipy/labs/bindings/linalg.pyx":113 * fff_vector_memcpy(y, x) * fff_vector_set(y, i, a) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -971,7 +1446,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":114 + /* "nipy/labs/bindings/linalg.pyx":114 * fff_vector_set(y, i, a) * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -980,11 +1455,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Y); - __pyx_v_Y = __pyx_t_1; + __pyx_v_Y = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":115 + /* "nipy/labs/bindings/linalg.pyx":115 * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) * return Y # <<<<<<<<<<<<<< @@ -992,86 +1466,102 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set(PyObject *__p * def vector_set_all(X, double a): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Y); - __pyx_r = __pyx_v_Y; + __Pyx_INCREF(((PyObject *)__pyx_v_Y)); + __pyx_r = ((PyObject *)__pyx_v_Y); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Y); + __Pyx_XDECREF((PyObject *)__pyx_v_Y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":117 - * return Y - * - * def vector_set_all(X, double a): # <<<<<<<<<<<<<< - * """ - * Set to a constant value. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_set_all[] = "\n Set to a constant value.\n vector_set_all(x, a)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_5vector_set_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_4vector_set_all[] = "\n Set to a constant value.\n vector_set_all(x, a)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_5vector_set_all = {__Pyx_NAMESTR("vector_set_all"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_5vector_set_all, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_4vector_set_all)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_5vector_set_all(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_a; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_v_Y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; - __Pyx_RefNannySetupContext("vector_set_all"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_set_all (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_set_all", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_set_all") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_set_all", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_set_all") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_a = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_a = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_set_all", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set_all"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set_all", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Y = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_4vector_set_all(__pyx_self, __pyx_v_X, __pyx_v_a); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":117 + * return Y + * + * def vector_set_all(X, double a): # <<<<<<<<<<<<<< + * """ + * Set to a constant value. + */ - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":123 +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_4vector_set_all(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyArrayObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_set_all", 0); + + /* "nipy/labs/bindings/linalg.pyx":123 * """ * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1079,9 +1569,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject * fff_vector_memcpy(y, x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":124 + /* "nipy/labs/bindings/linalg.pyx":124 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1090,7 +1583,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":125 + /* "nipy/labs/bindings/linalg.pyx":125 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1099,7 +1592,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":126 + /* "nipy/labs/bindings/linalg.pyx":126 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_vector_set_all(y, a) # <<<<<<<<<<<<<< @@ -1108,7 +1601,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject */ fff_vector_set_all(__pyx_v_y, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":127 + /* "nipy/labs/bindings/linalg.pyx":127 * fff_vector_memcpy(y, x) * fff_vector_set_all(y, a) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1117,7 +1610,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":128 + /* "nipy/labs/bindings/linalg.pyx":128 * fff_vector_set_all(y, a) * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1126,11 +1619,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Y); - __pyx_v_Y = __pyx_t_1; + __pyx_v_Y = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":129 + /* "nipy/labs/bindings/linalg.pyx":129 * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) * return Y # <<<<<<<<<<<<<< @@ -1138,86 +1630,102 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all(PyObject * def vector_scale(X, double a): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Y); - __pyx_r = __pyx_v_Y; + __Pyx_INCREF(((PyObject *)__pyx_v_Y)); + __pyx_r = ((PyObject *)__pyx_v_Y); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set_all"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_set_all", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Y); + __Pyx_XDECREF((PyObject *)__pyx_v_Y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":131 - * return Y - * - * def vector_scale(X, double a): # <<<<<<<<<<<<<< - * """ - * Multiply by a constant value. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_scale[] = "\n Multiply by a constant value.\n y = vector_scale(x, a)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_7vector_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_6vector_scale[] = "\n Multiply by a constant value.\n y = vector_scale(x, a)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_7vector_scale = {__Pyx_NAMESTR("vector_scale"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_7vector_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_6vector_scale)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_7vector_scale(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_a; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_v_Y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; - __Pyx_RefNannySetupContext("vector_scale"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_scale (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_a = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_a = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_scale"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Y = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_6vector_scale(__pyx_self, __pyx_v_X, __pyx_v_a); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":131 + * return Y + * + * def vector_scale(X, double a): # <<<<<<<<<<<<<< + * """ + * Multiply by a constant value. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_6vector_scale(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyArrayObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_scale", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":137 + /* "nipy/labs/bindings/linalg.pyx":137 * """ * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1225,9 +1733,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ * fff_vector_memcpy(y, x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":138 + /* "nipy/labs/bindings/linalg.pyx":138 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1236,7 +1747,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":139 + /* "nipy/labs/bindings/linalg.pyx":139 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1245,7 +1756,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":140 + /* "nipy/labs/bindings/linalg.pyx":140 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_vector_scale(y, a) # <<<<<<<<<<<<<< @@ -1254,7 +1765,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ */ fff_vector_scale(__pyx_v_y, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":141 + /* "nipy/labs/bindings/linalg.pyx":141 * fff_vector_memcpy(y, x) * fff_vector_scale(y, a) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1263,7 +1774,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":142 + /* "nipy/labs/bindings/linalg.pyx":142 * fff_vector_scale(y, a) * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1272,11 +1783,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Y); - __pyx_v_Y = __pyx_t_1; + __pyx_v_Y = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":143 + /* "nipy/labs/bindings/linalg.pyx":143 * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) * return Y # <<<<<<<<<<<<<< @@ -1284,86 +1794,102 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale(PyObject *_ * def vector_add_constant(X, double a): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Y); - __pyx_r = __pyx_v_Y; + __Pyx_INCREF(((PyObject *)__pyx_v_Y)); + __pyx_r = ((PyObject *)__pyx_v_Y); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_scale"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Y); + __Pyx_XDECREF((PyObject *)__pyx_v_Y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":145 - * return Y - * - * def vector_add_constant(X, double a): # <<<<<<<<<<<<<< - * """ - * Add a constant value. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_add_constant[] = "\n Add a constant value.\n y = vector_add_constant(x, a)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_9vector_add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_8vector_add_constant[] = "\n Add a constant value.\n y = vector_add_constant(x, a)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_9vector_add_constant = {__Pyx_NAMESTR("vector_add_constant"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_9vector_add_constant, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_8vector_add_constant)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_9vector_add_constant(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_a; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_v_Y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; - __Pyx_RefNannySetupContext("vector_add_constant"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_add_constant (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__a,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_add_constant", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_add_constant") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__a)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_add_constant", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_add_constant") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_a = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_a = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_a == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_add_constant", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add_constant"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add_constant", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Y = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_8vector_add_constant(__pyx_self, __pyx_v_X, __pyx_v_a); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":145 + * return Y + * + * def vector_add_constant(X, double a): # <<<<<<<<<<<<<< + * """ + * Add a constant value. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_8vector_add_constant(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_a) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyArrayObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_add_constant", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":151 + /* "nipy/labs/bindings/linalg.pyx":151 * """ * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1371,9 +1897,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb * fff_vector_memcpy(y, x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":152 + /* "nipy/labs/bindings/linalg.pyx":152 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1382,7 +1911,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":153 + /* "nipy/labs/bindings/linalg.pyx":153 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1391,7 +1920,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":154 + /* "nipy/labs/bindings/linalg.pyx":154 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_vector_add_constant(y, a) # <<<<<<<<<<<<<< @@ -1400,7 +1929,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb */ fff_vector_add_constant(__pyx_v_y, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":155 + /* "nipy/labs/bindings/linalg.pyx":155 * fff_vector_memcpy(y, x) * fff_vector_add_constant(y, a) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1409,7 +1938,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":156 + /* "nipy/labs/bindings/linalg.pyx":156 * fff_vector_add_constant(y, a) * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1418,11 +1947,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Y); - __pyx_v_Y = __pyx_t_1; + __pyx_v_Y = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":157 + /* "nipy/labs/bindings/linalg.pyx":157 * fff_vector_delete(x) * Y = fff_vector_toPyArray(y) * return Y # <<<<<<<<<<<<<< @@ -1430,87 +1958,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant(PyOb * def vector_add(X, Y): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Y); - __pyx_r = __pyx_v_Y; + __Pyx_INCREF(((PyObject *)__pyx_v_Y)); + __pyx_r = ((PyObject *)__pyx_v_Y); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add_constant"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add_constant", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Y); + __Pyx_XDECREF((PyObject *)__pyx_v_Y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":159 - * return Y - * - * def vector_add(X, Y): # <<<<<<<<<<<<<< - * """ - * Add two vectors. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_add[] = "\n Add two vectors.\n z = vector_add(x, y)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_11vector_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_10vector_add[] = "\n Add two vectors.\n z = vector_add(x, y)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_11vector_add = {__Pyx_NAMESTR("vector_add"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_11vector_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_10vector_add)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_11vector_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("vector_add"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_Y = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_10vector_add(__pyx_self, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":165 +/* "nipy/labs/bindings/linalg.pyx":159 + * return Y + * + * def vector_add(X, Y): # <<<<<<<<<<<<<< + * """ + * Add two vectors. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_10vector_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + PyArrayObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_add", 0); + + /* "nipy/labs/bindings/linalg.pyx":165 * """ * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1518,9 +2062,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p * z = fff_vector_new(x.size) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":166 + /* "nipy/labs/bindings/linalg.pyx":166 * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -1528,9 +2075,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p * fff_vector_memcpy(z, x) */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":167 + /* "nipy/labs/bindings/linalg.pyx":167 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1539,7 +2089,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ __pyx_v_z = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":168 + /* "nipy/labs/bindings/linalg.pyx":168 * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) # <<<<<<<<<<<<<< @@ -1548,7 +2098,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ fff_vector_memcpy(__pyx_v_z, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":169 + /* "nipy/labs/bindings/linalg.pyx":169 * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) * fff_vector_add(z, y) # <<<<<<<<<<<<<< @@ -1557,7 +2107,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ fff_vector_add(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":170 + /* "nipy/labs/bindings/linalg.pyx":170 * fff_vector_memcpy(z, x) * fff_vector_add(z, y) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1566,7 +2116,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":171 + /* "nipy/labs/bindings/linalg.pyx":171 * fff_vector_add(z, y) * fff_vector_delete(x) * fff_vector_delete(y) # <<<<<<<<<<<<<< @@ -1575,7 +2125,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ fff_vector_delete(__pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":172 + /* "nipy/labs/bindings/linalg.pyx":172 * fff_vector_delete(x) * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) # <<<<<<<<<<<<<< @@ -1584,11 +2134,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_1; + __pyx_v_Z = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":173 + /* "nipy/labs/bindings/linalg.pyx":173 * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) * return Z # <<<<<<<<<<<<<< @@ -1596,87 +2145,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add(PyObject *__p * def vector_sub(X, Y): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Z); - __pyx_r = __pyx_v_Z; + __Pyx_INCREF(((PyObject *)__pyx_v_Z)); + __pyx_r = ((PyObject *)__pyx_v_Z); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); + __Pyx_XDECREF((PyObject *)__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":175 - * return Z - * - * def vector_sub(X, Y): # <<<<<<<<<<<<<< - * """ - * Substract two vectors: x - y - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sub[] = "\n Substract two vectors: x - y\n z = vector_sub(x, y)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_13vector_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_12vector_sub[] = "\n Substract two vectors: x - y\n z = vector_sub(x, y)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_13vector_sub = {__Pyx_NAMESTR("vector_sub"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_13vector_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_12vector_sub)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_13vector_sub(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("vector_sub"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_sub (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_sub", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_sub", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_sub") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_Y = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_sub", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sub"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sub", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_12vector_sub(__pyx_self, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":175 + * return Z + * + * def vector_sub(X, Y): # <<<<<<<<<<<<<< + * """ + * Substract two vectors: x - y + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_12vector_sub(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + PyArrayObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_sub", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":181 + /* "nipy/labs/bindings/linalg.pyx":181 * """ * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1684,9 +2249,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p * z = fff_vector_new(x.size) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":182 + /* "nipy/labs/bindings/linalg.pyx":182 * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -1694,9 +2262,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p * fff_vector_memcpy(z, x) */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":183 + /* "nipy/labs/bindings/linalg.pyx":183 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1705,7 +2276,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ __pyx_v_z = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":184 + /* "nipy/labs/bindings/linalg.pyx":184 * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) # <<<<<<<<<<<<<< @@ -1714,7 +2285,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ fff_vector_memcpy(__pyx_v_z, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":185 + /* "nipy/labs/bindings/linalg.pyx":185 * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) * fff_vector_sub(z, y) # <<<<<<<<<<<<<< @@ -1723,7 +2294,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ fff_vector_sub(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":186 + /* "nipy/labs/bindings/linalg.pyx":186 * fff_vector_memcpy(z, x) * fff_vector_sub(z, y) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1732,7 +2303,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":187 + /* "nipy/labs/bindings/linalg.pyx":187 * fff_vector_sub(z, y) * fff_vector_delete(x) * fff_vector_delete(y) # <<<<<<<<<<<<<< @@ -1741,7 +2312,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ fff_vector_delete(__pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":188 + /* "nipy/labs/bindings/linalg.pyx":188 * fff_vector_delete(x) * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) # <<<<<<<<<<<<<< @@ -1750,11 +2321,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_1; + __pyx_v_Z = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":189 + /* "nipy/labs/bindings/linalg.pyx":189 * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) * return Z # <<<<<<<<<<<<<< @@ -1762,97 +2332,116 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub(PyObject *__p * def vector_mul(X, Y): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Z); - __pyx_r = __pyx_v_Z; + __Pyx_INCREF(((PyObject *)__pyx_v_Z)); + __pyx_r = ((PyObject *)__pyx_v_Z); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sub"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sub", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); + __Pyx_XDECREF((PyObject *)__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":191 - * return Z - * - * def vector_mul(X, Y): # <<<<<<<<<<<<<< - * """ - * Element-wise multiplication. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_mul[] = "\n Element-wise multiplication.\n z = vector_mul(x, y)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_15vector_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_14vector_mul[] = "\n Element-wise multiplication.\n z = vector_mul(x, y)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_15vector_mul = {__Pyx_NAMESTR("vector_mul"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_15vector_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_14vector_mul)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_15vector_mul(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("vector_mul"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_mul (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_mul", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_mul", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_mul") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_Y = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_mul", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_mul"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_mul", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_14vector_mul(__pyx_self, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":197 +/* "nipy/labs/bindings/linalg.pyx":191 + * return Z + * + * def vector_mul(X, Y): # <<<<<<<<<<<<<< * """ - * cdef fff_vector *x, *y, *z - * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< - * y = fff_vector_fromPyArray(Y) + * Element-wise multiplication. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_14vector_mul(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + PyArrayObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_mul", 0); + + /* "nipy/labs/bindings/linalg.pyx":197 + * """ + * cdef fff_vector *x, *y, *z + * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< + * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":198 + /* "nipy/labs/bindings/linalg.pyx":198 * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -1860,9 +2449,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p * fff_vector_memcpy(z, x) */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":199 + /* "nipy/labs/bindings/linalg.pyx":199 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1871,7 +2463,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ __pyx_v_z = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":200 + /* "nipy/labs/bindings/linalg.pyx":200 * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) # <<<<<<<<<<<<<< @@ -1880,7 +2472,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ fff_vector_memcpy(__pyx_v_z, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":201 + /* "nipy/labs/bindings/linalg.pyx":201 * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) * fff_vector_mul(z, y) # <<<<<<<<<<<<<< @@ -1889,7 +2481,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ fff_vector_mul(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":202 + /* "nipy/labs/bindings/linalg.pyx":202 * fff_vector_memcpy(z, x) * fff_vector_mul(z, y) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1898,7 +2490,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":203 + /* "nipy/labs/bindings/linalg.pyx":203 * fff_vector_mul(z, y) * fff_vector_delete(x) * fff_vector_delete(y) # <<<<<<<<<<<<<< @@ -1907,7 +2499,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ fff_vector_delete(__pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":204 + /* "nipy/labs/bindings/linalg.pyx":204 * fff_vector_delete(x) * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) # <<<<<<<<<<<<<< @@ -1916,11 +2508,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_1; + __pyx_v_Z = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":205 + /* "nipy/labs/bindings/linalg.pyx":205 * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) * return Z # <<<<<<<<<<<<<< @@ -1928,87 +2519,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul(PyObject *__p * def vector_div(X, Y): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Z); - __pyx_r = __pyx_v_Z; + __Pyx_INCREF(((PyObject *)__pyx_v_Z)); + __pyx_r = ((PyObject *)__pyx_v_Z); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_mul"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_mul", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); + __Pyx_XDECREF((PyObject *)__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":207 - * return Z - * - * def vector_div(X, Y): # <<<<<<<<<<<<<< - * """ - * Element-wise division. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_div[] = "\n Element-wise division.\n z = vector_div(x, y)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_17vector_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_16vector_div[] = "\n Element-wise division.\n z = vector_div(x, y)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_17vector_div = {__Pyx_NAMESTR("vector_div"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_17vector_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_16vector_div)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_17vector_div(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("vector_div"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_div (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_div", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_div", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_div") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_Y = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_div", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_div"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_div", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_16vector_div(__pyx_self, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":207 + * return Z + * + * def vector_div(X, Y): # <<<<<<<<<<<<<< + * """ + * Element-wise division. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_16vector_div(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + PyArrayObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_div", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":213 + /* "nipy/labs/bindings/linalg.pyx":213 * """ * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2016,9 +2623,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p * z = fff_vector_new(x.size) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":214 + /* "nipy/labs/bindings/linalg.pyx":214 * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -2026,9 +2636,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p * fff_vector_memcpy(z, x) */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":215 + /* "nipy/labs/bindings/linalg.pyx":215 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -2037,7 +2650,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ __pyx_v_z = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":216 + /* "nipy/labs/bindings/linalg.pyx":216 * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) # <<<<<<<<<<<<<< @@ -2046,7 +2659,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ fff_vector_memcpy(__pyx_v_z, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":217 + /* "nipy/labs/bindings/linalg.pyx":217 * z = fff_vector_new(x.size) * fff_vector_memcpy(z, x) * fff_vector_mul(z, y) # <<<<<<<<<<<<<< @@ -2055,7 +2668,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ fff_vector_mul(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":218 + /* "nipy/labs/bindings/linalg.pyx":218 * fff_vector_memcpy(z, x) * fff_vector_mul(z, y) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2064,7 +2677,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":219 + /* "nipy/labs/bindings/linalg.pyx":219 * fff_vector_mul(z, y) * fff_vector_delete(x) * fff_vector_delete(y) # <<<<<<<<<<<<<< @@ -2073,7 +2686,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ fff_vector_delete(__pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":220 + /* "nipy/labs/bindings/linalg.pyx":220 * fff_vector_delete(x) * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) # <<<<<<<<<<<<<< @@ -2082,11 +2695,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_1; + __pyx_v_Z = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":221 + /* "nipy/labs/bindings/linalg.pyx":221 * fff_vector_delete(y) * Z = fff_vector_toPyArray(z) * return Z # <<<<<<<<<<<<<< @@ -2094,24 +2706,37 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Z); - __pyx_r = __pyx_v_Z; + __Pyx_INCREF(((PyObject *)__pyx_v_Z)); + __pyx_r = ((PyObject *)__pyx_v_Z); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_div"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_div", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); + __Pyx_XDECREF((PyObject *)__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":224 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_19vector_sum(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_18vector_sum[] = "\n Sum up array elements.\n s = vector_sum(x)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_19vector_sum = {__Pyx_NAMESTR("vector_sum"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_19vector_sum, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_18vector_sum)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_19vector_sum(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_sum (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_18vector_sum(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":224 * * * def vector_sum(X): # <<<<<<<<<<<<<< @@ -2119,17 +2744,18 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div(PyObject *__p * Sum up array elements. */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sum[] = "\n Sum up array elements.\n s = vector_sum(x)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_18vector_sum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { fff_vector *__pyx_v_x; long double __pyx_v_s; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("vector_sum"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_sum", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":231 + /* "nipy/labs/bindings/linalg.pyx":231 * cdef fff_vector* x * cdef long double s * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2137,9 +2763,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__p * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":232 + /* "nipy/labs/bindings/linalg.pyx":232 * cdef long double s * x = fff_vector_fromPyArray(X) * s = fff_vector_sum(x) # <<<<<<<<<<<<<< @@ -2148,7 +2777,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__p */ __pyx_v_s = fff_vector_sum(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":233 + /* "nipy/labs/bindings/linalg.pyx":233 * x = fff_vector_fromPyArray(X) * s = fff_vector_sum(x) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2157,7 +2786,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":234 + /* "nipy/labs/bindings/linalg.pyx":234 * s = fff_vector_sum(x) * fff_vector_delete(x) * return s # <<<<<<<<<<<<<< @@ -2175,7 +2804,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sum"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2183,87 +2812,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":236 - * return s - * - * def vector_ssd(X, double m=0, int fixed=1): # <<<<<<<<<<<<<< - * """ - * (Minimal) sum of squared differences. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_ssd[] = "\n (Minimal) sum of squared differences.\n s = vector_ssd(x, m=0, fixed=1)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_21vector_ssd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_20vector_ssd[] = "\n (Minimal) sum of squared differences.\n s = vector_ssd(x, m=0, fixed=1)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_21vector_ssd = {__Pyx_NAMESTR("vector_ssd"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_21vector_ssd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_20vector_ssd)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_21vector_ssd(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_m; int __pyx_v_fixed; - fff_vector *__pyx_v_x; - long double __pyx_v_s; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__m,&__pyx_n_s__fixed,0}; - __Pyx_RefNannySetupContext("vector_ssd"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_ssd (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__m,&__pyx_n_s__fixed,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m); - if (unlikely(value)) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fixed); - if (unlikely(value)) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fixed); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_ssd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_ssd") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_X = values[0]; if (values[1]) { __pyx_v_m = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_m == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_m = ((double)0); + + /* "nipy/labs/bindings/linalg.pyx":236 + * return s + * + * def vector_ssd(X, double m=0, int fixed=1): # <<<<<<<<<<<<<< + * """ + * (Minimal) sum of squared differences. + */ + __pyx_v_m = ((double)0.0); } if (values[2]) { __pyx_v_fixed = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_fixed == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_fixed = ((int)1); } - } else { - __pyx_v_m = ((double)0); - __pyx_v_fixed = ((int)1); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: __pyx_v_fixed = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_fixed == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_m = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_m == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_ssd", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_ssd"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_ssd", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_20vector_ssd(__pyx_self, __pyx_v_X, __pyx_v_m, __pyx_v_fixed); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_20vector_ssd(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_m, int __pyx_v_fixed) { + fff_vector *__pyx_v_x; + long double __pyx_v_s; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_ssd", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":243 + /* "nipy/labs/bindings/linalg.pyx":243 * cdef fff_vector* x * cdef long double s * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2271,9 +2916,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__p * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":244 + /* "nipy/labs/bindings/linalg.pyx":244 * cdef long double s * x = fff_vector_fromPyArray(X) * s = fff_vector_ssd(x, &m, fixed) # <<<<<<<<<<<<<< @@ -2282,7 +2930,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__p */ __pyx_v_s = fff_vector_ssd(__pyx_v_x, (&__pyx_v_m), __pyx_v_fixed); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":245 + /* "nipy/labs/bindings/linalg.pyx":245 * x = fff_vector_fromPyArray(X) * s = fff_vector_ssd(x, &m, fixed) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2291,7 +2939,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":246 + /* "nipy/labs/bindings/linalg.pyx":246 * s = fff_vector_ssd(x, &m, fixed) * fff_vector_delete(x) * return s # <<<<<<<<<<<<<< @@ -2309,7 +2957,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_ssd"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_ssd", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2317,73 +2965,90 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":248 - * return s - * - * def vector_sad(X, double m=0): # <<<<<<<<<<<<<< - * """ - * Sum of absolute differences. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sad[] = "\n Sum of absolute differences.\n s = vector_sad(x, m=0)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_23vector_sad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_22vector_sad[] = "\n Sum of absolute differences.\n s = vector_sad(x, m=0)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_23vector_sad = {__Pyx_NAMESTR("vector_sad"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_23vector_sad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_22vector_sad)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_23vector_sad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_m; - fff_vector *__pyx_v_x; - long double __pyx_v_s; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__m,0}; - __Pyx_RefNannySetupContext("vector_sad"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_sad (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__m,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m); - if (unlikely(value)) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__m); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_sad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_sad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_X = values[0]; if (values[1]) { __pyx_v_m = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_m == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_m = ((double)0); - } - } else { - __pyx_v_m = ((double)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_m = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_m == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; + + /* "nipy/labs/bindings/linalg.pyx":248 + * return s + * + * def vector_sad(X, double m=0): # <<<<<<<<<<<<<< + * """ + * Sum of absolute differences. + */ + __pyx_v_m = ((double)0.0); } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_sad", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sad"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_22vector_sad(__pyx_self, __pyx_v_X, __pyx_v_m); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_22vector_sad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_m) { + fff_vector *__pyx_v_x; + long double __pyx_v_s; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_sad", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":255 + /* "nipy/labs/bindings/linalg.pyx":255 * cdef fff_vector* x * cdef long double s * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2391,9 +3056,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":256 + /* "nipy/labs/bindings/linalg.pyx":256 * cdef long double s * x = fff_vector_fromPyArray(X) * s = fff_vector_sad(x, m) # <<<<<<<<<<<<<< @@ -2402,7 +3070,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p */ __pyx_v_s = fff_vector_sad(__pyx_v_x, __pyx_v_m); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":257 + /* "nipy/labs/bindings/linalg.pyx":257 * x = fff_vector_fromPyArray(X) * s = fff_vector_sad(x, m) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2411,7 +3079,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":258 + /* "nipy/labs/bindings/linalg.pyx":258 * s = fff_vector_sad(x, m) * fff_vector_delete(x) * return s # <<<<<<<<<<<<<< @@ -2429,7 +3097,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sad"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_sad", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2437,7 +3105,20 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":260 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_25vector_median(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_24vector_median[] = "\n Median.\n m = vector_median(x)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_25vector_median = {__Pyx_NAMESTR("vector_median"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_25vector_median, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_24vector_median)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_25vector_median(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_median (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_24vector_median(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":260 * return s * * def vector_median(X): # <<<<<<<<<<<<<< @@ -2445,17 +3126,18 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad(PyObject *__p * Median. */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_median[] = "\n Median.\n m = vector_median(x)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_24vector_median(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { fff_vector *__pyx_v_x; double __pyx_v_m; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("vector_median"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_median", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":267 + /* "nipy/labs/bindings/linalg.pyx":267 * cdef fff_vector* x * cdef double m * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2463,9 +3145,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject * * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":268 + /* "nipy/labs/bindings/linalg.pyx":268 * cdef double m * x = fff_vector_fromPyArray(X) * m = fff_vector_median(x) # <<<<<<<<<<<<<< @@ -2474,7 +3159,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject * */ __pyx_v_m = fff_vector_median(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":269 + /* "nipy/labs/bindings/linalg.pyx":269 * x = fff_vector_fromPyArray(X) * m = fff_vector_median(x) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2483,7 +3168,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject * */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":270 + /* "nipy/labs/bindings/linalg.pyx":270 * m = fff_vector_median(x) * fff_vector_delete(x) * return m # <<<<<<<<<<<<<< @@ -2501,7 +3186,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_median"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_median", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2509,77 +3194,93 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median(PyObject * return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":272 - * return m - * - * def vector_quantile(X, double r, int interp): # <<<<<<<<<<<<<< - * """ - * Quantile. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_vector_quantile[] = "\n Quantile.\n q = vector_quantile(x, r=0.5, interp=1)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_27vector_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_26vector_quantile[] = "\n Quantile.\n q = vector_quantile(x, r=0.5, interp=1)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_27vector_quantile = {__Pyx_NAMESTR("vector_quantile"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_27vector_quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_26vector_quantile)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_27vector_quantile(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; double __pyx_v_r; int __pyx_v_interp; - fff_vector *__pyx_v_x; - double __pyx_v_q; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__r,&__pyx_n_s__interp,0}; - __Pyx_RefNannySetupContext("vector_quantile"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("vector_quantile (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__r,&__pyx_n_s__interp,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__r); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_quantile", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("vector_quantile", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__r)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_quantile", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__interp)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("vector_quantile", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "vector_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "vector_quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_X = values[0]; __pyx_v_r = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_interp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_interp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_r = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_r == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_interp = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_interp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("vector_quantile", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_quantile"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_26vector_quantile(__pyx_self, __pyx_v_X, __pyx_v_r, __pyx_v_interp); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":272 + * return m + * + * def vector_quantile(X, double r, int interp): # <<<<<<<<<<<<<< + * """ + * Quantile. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_26vector_quantile(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, double __pyx_v_r, int __pyx_v_interp) { + fff_vector *__pyx_v_x; + double __pyx_v_q; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("vector_quantile", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":279 + /* "nipy/labs/bindings/linalg.pyx":279 * cdef fff_vector* x * cdef double q * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -2587,9 +3288,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject * fff_vector_delete(x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":280 + /* "nipy/labs/bindings/linalg.pyx":280 * cdef double q * x = fff_vector_fromPyArray(X) * q = fff_vector_quantile(x, r, interp) # <<<<<<<<<<<<<< @@ -2598,7 +3302,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject */ __pyx_v_q = fff_vector_quantile(__pyx_v_x, __pyx_v_r, __pyx_v_interp); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":281 + /* "nipy/labs/bindings/linalg.pyx":281 * x = fff_vector_fromPyArray(X) * q = fff_vector_quantile(x, r, interp) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -2607,7 +3311,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":282 + /* "nipy/labs/bindings/linalg.pyx":282 * q = fff_vector_quantile(x, r, interp) * fff_vector_delete(x) * return q # <<<<<<<<<<<<<< @@ -2625,7 +3329,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_quantile"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.vector_quantile", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2633,77 +3337,93 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile(PyObject return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":286 - * - * ## fff_matrix.h - * def matrix_get(A, size_t i, size_t j): # <<<<<<<<<<<<<< - * """ - * Get (i,j) element. - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_get[] = "\n Get (i,j) element.\n aij = matrix_get(A, i, j)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_29matrix_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_28matrix_get[] = "\n Get (i,j) element.\n aij = matrix_get(A, i, j)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_29matrix_get = {__Pyx_NAMESTR("matrix_get"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_29matrix_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_28matrix_get)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_29matrix_get(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; size_t __pyx_v_i; size_t __pyx_v_j; - fff_matrix *__pyx_v_a; - double __pyx_v_aij; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__i,&__pyx_n_s__j,0}; - __Pyx_RefNannySetupContext("matrix_get"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("matrix_get (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__i,&__pyx_n_s__j,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("matrix_get", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__i)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("matrix_get", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("matrix_get", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__j); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("matrix_get", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matrix_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "matrix_get") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_A = values[0]; __pyx_v_i = __Pyx_PyInt_AsSize_t(values[1]); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_j = __Pyx_PyInt_AsSize_t(values[2]); if (unlikely((__pyx_v_j == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_i = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_i == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_j = __Pyx_PyInt_AsSize_t(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_j == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("matrix_get", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_get"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_28matrix_get(__pyx_self, __pyx_v_A, __pyx_v_i, __pyx_v_j); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":286 + * + * ## fff_matrix.h + * def matrix_get(A, size_t i, size_t j): # <<<<<<<<<<<<<< + * """ + * Get (i,j) element. + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_28matrix_get(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, size_t __pyx_v_i, size_t __pyx_v_j) { + fff_matrix *__pyx_v_a; + double __pyx_v_aij; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("matrix_get", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":293 + /* "nipy/labs/bindings/linalg.pyx":293 * cdef fff_matrix* a * cdef double aij * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -2711,9 +3431,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p * fff_matrix_delete(a) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":294 + /* "nipy/labs/bindings/linalg.pyx":294 * cdef double aij * a = fff_matrix_fromPyArray(A) * aij = fff_matrix_get(a, i, j) # <<<<<<<<<<<<<< @@ -2722,7 +3445,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p */ __pyx_v_aij = fff_matrix_get(__pyx_v_a, __pyx_v_i, __pyx_v_j); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":295 + /* "nipy/labs/bindings/linalg.pyx":295 * a = fff_matrix_fromPyArray(A) * aij = fff_matrix_get(a, i, j) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -2731,7 +3454,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":296 + /* "nipy/labs/bindings/linalg.pyx":296 * aij = fff_matrix_get(a, i, j) * fff_matrix_delete(a) * return aij # <<<<<<<<<<<<<< @@ -2749,7 +3472,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_get"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2757,7 +3480,20 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":298 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_31matrix_transpose(PyObject *__pyx_self, PyObject *__pyx_v_A); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_30matrix_transpose[] = "\n Transpose a matrix.\n B = matrix_transpose(A)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_31matrix_transpose = {__Pyx_NAMESTR("matrix_transpose"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_31matrix_transpose, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_30matrix_transpose)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_31matrix_transpose(PyObject *__pyx_self, PyObject *__pyx_v_A) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("matrix_transpose (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_30matrix_transpose(__pyx_self, ((PyObject *)__pyx_v_A)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":298 * return aij * * def matrix_transpose(A): # <<<<<<<<<<<<<< @@ -2765,19 +3501,19 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get(PyObject *__p * Transpose a matrix. */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObject *__pyx_self, PyObject *__pyx_v_A); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_transpose[] = "\n Transpose a matrix.\n B = matrix_transpose(A)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObject *__pyx_self, PyObject *__pyx_v_A) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_30matrix_transpose(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A) { fff_matrix *__pyx_v_a; fff_matrix *__pyx_v_b; - PyObject *__pyx_v_B; + PyArrayObject *__pyx_v_B = NULL; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("matrix_transpose"); - __pyx_self = __pyx_self; - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("matrix_transpose", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":304 + /* "nipy/labs/bindings/linalg.pyx":304 * """ * cdef fff_matrix *a, *b * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -2785,9 +3521,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec * fff_matrix_transpose(b, a) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":305 + /* "nipy/labs/bindings/linalg.pyx":305 * cdef fff_matrix *a, *b * a = fff_matrix_fromPyArray(A) * b = fff_matrix_new(a.size2, a.size1) # <<<<<<<<<<<<<< @@ -2796,7 +3535,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec */ __pyx_v_b = fff_matrix_new(__pyx_v_a->size2, __pyx_v_a->size1); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":306 + /* "nipy/labs/bindings/linalg.pyx":306 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_new(a.size2, a.size1) * fff_matrix_transpose(b, a) # <<<<<<<<<<<<<< @@ -2805,7 +3544,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec */ fff_matrix_transpose(__pyx_v_b, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":307 + /* "nipy/labs/bindings/linalg.pyx":307 * b = fff_matrix_new(a.size2, a.size1) * fff_matrix_transpose(b, a) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -2814,7 +3553,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":308 + /* "nipy/labs/bindings/linalg.pyx":308 * fff_matrix_transpose(b, a) * fff_matrix_delete(a) * B = fff_matrix_toPyArray(b) # <<<<<<<<<<<<<< @@ -2823,11 +3562,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_1; + __pyx_v_B = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":309 + /* "nipy/labs/bindings/linalg.pyx":309 * fff_matrix_delete(a) * B = fff_matrix_toPyArray(b) * return B # <<<<<<<<<<<<<< @@ -2835,87 +3573,103 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose(PyObjec * def matrix_add(A, B): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_B); - __pyx_r = __pyx_v_B; + __Pyx_INCREF(((PyObject *)__pyx_v_B)); + __pyx_r = ((PyObject *)__pyx_v_B); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_transpose"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_transpose", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_B); + __Pyx_XDECREF((PyObject *)__pyx_v_B); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":311 - * return B - * - * def matrix_add(A, B): # <<<<<<<<<<<<<< - * """ - * C = matrix_add(A, B) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_add[] = "\n C = matrix_add(A, B)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_33matrix_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_32matrix_add[] = "\n C = matrix_add(A, B)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_33matrix_add = {__Pyx_NAMESTR("matrix_add"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_33matrix_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_32matrix_add)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_33matrix_add(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("matrix_add"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("matrix_add (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("matrix_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "matrix_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("matrix_add", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "matrix_add") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_A = values[0]; __pyx_v_B = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("matrix_add", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_add"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_add", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_32matrix_add(__pyx_self, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":311 + * return B + * + * def matrix_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = matrix_add(A, B) + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_32matrix_add(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("matrix_add", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":316 + /* "nipy/labs/bindings/linalg.pyx":316 * """ * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -2923,9 +3677,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p * c = fff_matrix_new(a.size1, a.size2) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":317 + /* "nipy/labs/bindings/linalg.pyx":317 * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -2933,9 +3690,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p * fff_matrix_memcpy(c, a) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":318 + /* "nipy/labs/bindings/linalg.pyx":318 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) # <<<<<<<<<<<<<< @@ -2944,7 +3704,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p */ __pyx_v_c = fff_matrix_new(__pyx_v_a->size1, __pyx_v_a->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":319 + /* "nipy/labs/bindings/linalg.pyx":319 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(c, a) # <<<<<<<<<<<<<< @@ -2953,7 +3713,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p */ fff_matrix_memcpy(__pyx_v_c, __pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":320 + /* "nipy/labs/bindings/linalg.pyx":320 * c = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(c, a) * fff_matrix_add(c, b) # <<<<<<<<<<<<<< @@ -2962,7 +3722,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p */ fff_matrix_add(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":321 + /* "nipy/labs/bindings/linalg.pyx":321 * fff_matrix_memcpy(c, a) * fff_matrix_add(c, b) * C = fff_matrix_toPyArray(c) # <<<<<<<<<<<<<< @@ -2971,11 +3731,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":322 + /* "nipy/labs/bindings/linalg.pyx":322 * fff_matrix_add(c, b) * C = fff_matrix_toPyArray(c) * return C # <<<<<<<<<<<<<< @@ -2983,24 +3742,24 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_add"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.matrix_add", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":326 +/* "nipy/labs/bindings/linalg.pyx":326 * * ## fff_blas.h * cdef CBLAS_TRANSPOSE_t flag_transpose( int flag ): # <<<<<<<<<<<<<< @@ -3008,13 +3767,14 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add(PyObject *__p * if flag <= 0: */ -static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(int __pyx_v_flag) { +static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(int __pyx_v_flag) { CBLAS_TRANSPOSE_t __pyx_v_x; CBLAS_TRANSPOSE_t __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("flag_transpose"); + __Pyx_RefNannySetupContext("flag_transpose", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":328 + /* "nipy/labs/bindings/linalg.pyx":328 * cdef CBLAS_TRANSPOSE_t flag_transpose( int flag ): * cdef CBLAS_TRANSPOSE_t x * if flag <= 0: # <<<<<<<<<<<<<< @@ -3024,7 +3784,7 @@ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(i __pyx_t_1 = (__pyx_v_flag <= 0); if (__pyx_t_1) { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":329 + /* "nipy/labs/bindings/linalg.pyx":329 * cdef CBLAS_TRANSPOSE_t x * if flag <= 0: * x = CblasNoTrans # <<<<<<<<<<<<<< @@ -3036,7 +3796,7 @@ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(i } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":331 + /* "nipy/labs/bindings/linalg.pyx":331 * x = CblasNoTrans * else: * x = CblasTrans # <<<<<<<<<<<<<< @@ -3047,7 +3807,7 @@ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(i } __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":332 + /* "nipy/labs/bindings/linalg.pyx":332 * else: * x = CblasTrans * return x # <<<<<<<<<<<<<< @@ -3062,7 +3822,7 @@ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(i return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":334 +/* "nipy/labs/bindings/linalg.pyx":334 * return x * * cdef CBLAS_UPLO_t flag_uplo( int flag ): # <<<<<<<<<<<<<< @@ -3070,13 +3830,14 @@ static CBLAS_TRANSPOSE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(i * if flag <= 0: */ -static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v_flag) { +static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v_flag) { CBLAS_UPLO_t __pyx_v_x; CBLAS_UPLO_t __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("flag_uplo"); + __Pyx_RefNannySetupContext("flag_uplo", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":336 + /* "nipy/labs/bindings/linalg.pyx":336 * cdef CBLAS_UPLO_t flag_uplo( int flag ): * cdef CBLAS_UPLO_t x * if flag <= 0: # <<<<<<<<<<<<<< @@ -3086,7 +3847,7 @@ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v __pyx_t_1 = (__pyx_v_flag <= 0); if (__pyx_t_1) { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":337 + /* "nipy/labs/bindings/linalg.pyx":337 * cdef CBLAS_UPLO_t x * if flag <= 0: * x = CblasUpper # <<<<<<<<<<<<<< @@ -3098,7 +3859,7 @@ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":339 + /* "nipy/labs/bindings/linalg.pyx":339 * x = CblasUpper * else: * x = CblasLower # <<<<<<<<<<<<<< @@ -3109,7 +3870,7 @@ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v } __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":340 + /* "nipy/labs/bindings/linalg.pyx":340 * else: * x = CblasLower * return x # <<<<<<<<<<<<<< @@ -3124,7 +3885,7 @@ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":342 +/* "nipy/labs/bindings/linalg.pyx":342 * return x * * cdef CBLAS_DIAG_t flag_diag( int flag ): # <<<<<<<<<<<<<< @@ -3132,13 +3893,14 @@ static CBLAS_UPLO_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(int __pyx_v * if flag <= 0: */ -static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v_flag) { +static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v_flag) { CBLAS_DIAG_t __pyx_v_x; CBLAS_DIAG_t __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("flag_diag"); + __Pyx_RefNannySetupContext("flag_diag", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":344 + /* "nipy/labs/bindings/linalg.pyx":344 * cdef CBLAS_DIAG_t flag_diag( int flag ): * cdef CBLAS_DIAG_t x * if flag <= 0: # <<<<<<<<<<<<<< @@ -3148,7 +3910,7 @@ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v __pyx_t_1 = (__pyx_v_flag <= 0); if (__pyx_t_1) { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":345 + /* "nipy/labs/bindings/linalg.pyx":345 * cdef CBLAS_DIAG_t x * if flag <= 0: * x = CblasNonUnit # <<<<<<<<<<<<<< @@ -3160,7 +3922,7 @@ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":347 + /* "nipy/labs/bindings/linalg.pyx":347 * x = CblasNonUnit * else: * x = CblasUnit # <<<<<<<<<<<<<< @@ -3171,7 +3933,7 @@ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v } __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":348 + /* "nipy/labs/bindings/linalg.pyx":348 * else: * x = CblasUnit * return x # <<<<<<<<<<<<<< @@ -3186,7 +3948,7 @@ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":350 +/* "nipy/labs/bindings/linalg.pyx":350 * return x * * cdef CBLAS_SIDE_t flag_side( int flag ): # <<<<<<<<<<<<<< @@ -3194,13 +3956,14 @@ static CBLAS_DIAG_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(int __pyx_v * if flag <= 0: */ -static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v_flag) { +static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v_flag) { CBLAS_SIDE_t __pyx_v_x; CBLAS_SIDE_t __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("flag_side"); + __Pyx_RefNannySetupContext("flag_side", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":352 + /* "nipy/labs/bindings/linalg.pyx":352 * cdef CBLAS_SIDE_t flag_side( int flag ): * cdef CBLAS_SIDE_t x * if flag <= 0: # <<<<<<<<<<<<<< @@ -3210,7 +3973,7 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v __pyx_t_1 = (__pyx_v_flag <= 0); if (__pyx_t_1) { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":353 + /* "nipy/labs/bindings/linalg.pyx":353 * cdef CBLAS_SIDE_t x * if flag <= 0: * x = CblasLeft # <<<<<<<<<<<<<< @@ -3222,7 +3985,7 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":355 + /* "nipy/labs/bindings/linalg.pyx":355 * x = CblasLeft * else: * x = CblasRight # <<<<<<<<<<<<<< @@ -3233,7 +3996,7 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v } __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":356 + /* "nipy/labs/bindings/linalg.pyx":356 * else: * x = CblasRight * return x # <<<<<<<<<<<<<< @@ -3248,7 +4011,19 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":360 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_35blas_dnrm2(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_35blas_dnrm2 = {__Pyx_NAMESTR("blas_dnrm2"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_35blas_dnrm2, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_35blas_dnrm2(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dnrm2 (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_34blas_dnrm2(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":360 * * ### BLAS 1 * def blas_dnrm2(X): # <<<<<<<<<<<<<< @@ -3256,15 +4031,17 @@ static CBLAS_SIDE_t __pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(int __pyx_v * x = fff_vector_fromPyArray(X) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_34blas_dnrm2(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { fff_vector *__pyx_v_x; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("blas_dnrm2"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dnrm2", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":362 + /* "nipy/labs/bindings/linalg.pyx":362 * def blas_dnrm2(X): * cdef fff_vector *x * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -3272,9 +4049,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__p * */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":363 + /* "nipy/labs/bindings/linalg.pyx":363 * cdef fff_vector *x * x = fff_vector_fromPyArray(X) * return fff_blas_dnrm2(x) # <<<<<<<<<<<<<< @@ -3292,7 +4072,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dnrm2"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dnrm2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3300,7 +4080,19 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":365 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_37blas_dasum(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_37blas_dasum = {__Pyx_NAMESTR("blas_dasum"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_37blas_dasum, METH_O, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_37blas_dasum(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dasum (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_36blas_dasum(__pyx_self, ((PyObject *)__pyx_v_X)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":365 * return fff_blas_dnrm2(x) * * def blas_dasum(X): # <<<<<<<<<<<<<< @@ -3308,15 +4100,17 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2(PyObject *__p * x = fff_vector_fromPyArray(X) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_36blas_dasum(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X) { fff_vector *__pyx_v_x; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("blas_dasum"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dasum", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":367 + /* "nipy/labs/bindings/linalg.pyx":367 * def blas_dasum(X): * cdef fff_vector *x * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -3324,9 +4118,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum(PyObject *__p * */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":368 + /* "nipy/labs/bindings/linalg.pyx":368 * cdef fff_vector *x * x = fff_vector_fromPyArray(X) * return fff_blas_dasum(x) # <<<<<<<<<<<<<< @@ -3344,7 +4141,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum(PyObject *__p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dasum"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dasum", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3352,66 +4149,83 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum(PyObject *__p return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":370 - * return fff_blas_dasum(x) - * - * def blas_ddot(X, Y): # <<<<<<<<<<<<<< - * cdef fff_vector *x, *y - * x = fff_vector_fromPyArray(X) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_39blas_ddot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_39blas_ddot = {__Pyx_NAMESTR("blas_ddot"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_39blas_ddot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_39blas_ddot(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("blas_ddot"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_ddot (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_ddot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_ddot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_ddot", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_ddot") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_X = values[0]; __pyx_v_Y = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_ddot", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_ddot"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_ddot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_38blas_ddot(__pyx_self, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":370 + * return fff_blas_dasum(x) + * + * def blas_ddot(X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_38blas_ddot(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_ddot", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":372 + /* "nipy/labs/bindings/linalg.pyx":372 * def blas_ddot(X, Y): * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -3419,9 +4233,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__py * return fff_blas_ddot(x, y) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":373 + /* "nipy/labs/bindings/linalg.pyx":373 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -3429,9 +4246,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__py * */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":374 + /* "nipy/labs/bindings/linalg.pyx":374 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * return fff_blas_ddot(x, y) # <<<<<<<<<<<<<< @@ -3449,7 +4269,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_ddot"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_ddot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3457,79 +4277,94 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot(PyObject *__py return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":376 - * return fff_blas_ddot(x, y) - * - * def blas_daxpy(double alpha, X, Y): # <<<<<<<<<<<<<< - * cdef fff_vector *x, *y, *z - * x = fff_vector_fromPyArray(X) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_41blas_daxpy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_41blas_daxpy = {__Pyx_NAMESTR("blas_daxpy"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_41blas_daxpy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_41blas_daxpy(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_alpha; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_Y = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__X,&__pyx_n_s__Y,0}; - __Pyx_RefNannySetupContext("blas_daxpy"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_daxpy (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__X,&__pyx_n_s__Y,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_daxpy", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_daxpy", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_daxpy", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_daxpy", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_daxpy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_daxpy") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = values[1]; __pyx_v_Y = values[2]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 2); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_daxpy", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_daxpy"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_daxpy", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_40blas_daxpy(__pyx_self, __pyx_v_alpha, __pyx_v_X, __pyx_v_Y); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":376 + * return fff_blas_ddot(x, y) + * + * def blas_daxpy(double alpha, X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y, *z + * x = fff_vector_fromPyArray(X) + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_40blas_daxpy(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_alpha, PyObject *__pyx_v_X, PyObject *__pyx_v_Y) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + PyArrayObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_daxpy", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":378 + /* "nipy/labs/bindings/linalg.pyx":378 * def blas_daxpy(double alpha, X, Y): * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -3537,9 +4372,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p * z = fff_vector_new(y.size) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":379 + /* "nipy/labs/bindings/linalg.pyx":379 * cdef fff_vector *x, *y, *z * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) # <<<<<<<<<<<<<< @@ -3547,9 +4385,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p * fff_vector_memcpy(z, y) */ if (!(likely(((__pyx_v_Y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_Y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_Y)); + __pyx_t_1 = __pyx_v_Y; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_y = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":380 + /* "nipy/labs/bindings/linalg.pyx":380 * x = fff_vector_fromPyArray(X) * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(y.size) # <<<<<<<<<<<<<< @@ -3558,7 +4399,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p */ __pyx_v_z = fff_vector_new(__pyx_v_y->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":381 + /* "nipy/labs/bindings/linalg.pyx":381 * y = fff_vector_fromPyArray(Y) * z = fff_vector_new(y.size) * fff_vector_memcpy(z, y) # <<<<<<<<<<<<<< @@ -3567,7 +4408,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p */ fff_vector_memcpy(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":382 + /* "nipy/labs/bindings/linalg.pyx":382 * z = fff_vector_new(y.size) * fff_vector_memcpy(z, y) * fff_blas_daxpy(alpha, x, z) # <<<<<<<<<<<<<< @@ -3576,7 +4417,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p */ fff_blas_daxpy(__pyx_v_alpha, __pyx_v_x, __pyx_v_z); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":383 + /* "nipy/labs/bindings/linalg.pyx":383 * fff_vector_memcpy(z, y) * fff_blas_daxpy(alpha, x, z) * Z = fff_vector_toPyArray(z) # <<<<<<<<<<<<<< @@ -3585,11 +4426,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_z)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_1; + __pyx_v_Z = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":384 + /* "nipy/labs/bindings/linalg.pyx":384 * fff_blas_daxpy(alpha, x, z) * Z = fff_vector_toPyArray(z) * return Z # <<<<<<<<<<<<<< @@ -3597,85 +4437,101 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy(PyObject *__p * def blas_dscal(double alpha, X): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Z); - __pyx_r = __pyx_v_Z; + __Pyx_INCREF(((PyObject *)__pyx_v_Z)); + __pyx_r = ((PyObject *)__pyx_v_Z); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_daxpy"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_daxpy", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); + __Pyx_XDECREF((PyObject *)__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":386 - * return Z - * - * def blas_dscal(double alpha, X): # <<<<<<<<<<<<<< - * cdef fff_vector *x, *y - * x = fff_vector_fromPyArray(X) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_43blas_dscal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_43blas_dscal = {__Pyx_NAMESTR("blas_dscal"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_43blas_dscal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_43blas_dscal(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_alpha; PyObject *__pyx_v_X = 0; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - PyObject *__pyx_v_Y; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__X,0}; - __Pyx_RefNannySetupContext("blas_dscal"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dscal (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__alpha,&__pyx_n_s__X,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dscal", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dscal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dscal", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dscal") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dscal", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dscal"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dscal", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_Y = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_42blas_dscal(__pyx_self, __pyx_v_alpha, __pyx_v_X); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":386 + * return Z + * + * def blas_dscal(double alpha, X): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_42blas_dscal(CYTHON_UNUSED PyObject *__pyx_self, double __pyx_v_alpha, PyObject *__pyx_v_X) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + PyArrayObject *__pyx_v_Y = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dscal", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":388 + /* "nipy/labs/bindings/linalg.pyx":388 * def blas_dscal(double alpha, X): * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< @@ -3683,9 +4539,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p * fff_vector_memcpy(y, x) */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_1 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":389 + /* "nipy/labs/bindings/linalg.pyx":389 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -3694,7 +4553,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":390 + /* "nipy/labs/bindings/linalg.pyx":390 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -3703,7 +4562,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":391 + /* "nipy/labs/bindings/linalg.pyx":391 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_blas_dscal(alpha, y) # <<<<<<<<<<<<<< @@ -3712,7 +4571,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p */ fff_blas_dscal(__pyx_v_alpha, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":392 + /* "nipy/labs/bindings/linalg.pyx":392 * fff_vector_memcpy(y, x) * fff_blas_dscal(alpha, y) * Y = fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -3721,11 +4580,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_vector_toPyArray(__pyx_v_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_Y); - __pyx_v_Y = __pyx_t_1; + __pyx_v_Y = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":393 + /* "nipy/labs/bindings/linalg.pyx":393 * fff_blas_dscal(alpha, y) * Y = fff_vector_toPyArray(y) * return Y # <<<<<<<<<<<<<< @@ -3733,34 +4591,28 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_Y); - __pyx_r = __pyx_v_Y; + __Pyx_INCREF(((PyObject *)__pyx_v_Y)); + __pyx_r = ((PyObject *)__pyx_v_Y); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dscal"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dscal", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Y); + __Pyx_XDECREF((PyObject *)__pyx_v_Y); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":398 - * - * ### BLAS 3 - * def blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< - * """ - * D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C). - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dgemm[] = "\n D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C).\n \n Compute the matrix-matrix product and sum D = alpha op(A) op(B) +\n beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans,\n CblasTrans, CblasConjTrans and similarly for the parameter TransB.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_45blas_dgemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_44blas_dgemm[] = "\n D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C).\n \n Compute the matrix-matrix product and sum D = alpha op(A) op(B) +\n beta C where op(A) = A, A^T, A^H for TransA = CblasNoTrans,\n CblasTrans, CblasConjTrans and similarly for the parameter TransB.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_45blas_dgemm = {__Pyx_NAMESTR("blas_dgemm"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_45blas_dgemm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_44blas_dgemm)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_45blas_dgemm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_TransA; int __pyx_v_TransB; double __pyx_v_alpha; @@ -3768,74 +4620,75 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p PyObject *__pyx_v_B = 0; double __pyx_v_beta; PyObject *__pyx_v_C = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - fff_matrix *__pyx_v_d; - PyObject *__pyx_v_D; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__TransA,&__pyx_n_s__TransB,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; - __Pyx_RefNannySetupContext("blas_dgemm"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dgemm (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__TransA,&__pyx_n_s__TransB,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransB); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransB)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dgemm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dgemm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_TransA = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_TransA == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_TransB = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_TransB == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -3844,27 +4697,43 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p __pyx_v_B = values[4]; __pyx_v_beta = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_C = values[6]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_TransA = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_TransA == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_TransB = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_TransB == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 4); - __pyx_v_beta = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = PyTuple_GET_ITEM(__pyx_args, 6); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dgemm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dgemm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dgemm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_D = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_44blas_dgemm(__pyx_self, __pyx_v_TransA, __pyx_v_TransB, __pyx_v_alpha, __pyx_v_A, __pyx_v_B, __pyx_v_beta, __pyx_v_C); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":398 + * + * ### BLAS 3 + * def blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C). + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_44blas_dgemm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_TransA, int __pyx_v_TransB, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, double __pyx_v_beta, PyObject *__pyx_v_C) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + fff_matrix *__pyx_v_d; + PyArrayObject *__pyx_v_D = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dgemm", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":407 + /* "nipy/labs/bindings/linalg.pyx":407 * """ * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -3872,9 +4741,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p * c = fff_matrix_fromPyArray(C) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":408 + /* "nipy/labs/bindings/linalg.pyx":408 * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -3882,9 +4754,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p * d = fff_matrix_new(c.size1, c.size2) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":409 + /* "nipy/labs/bindings/linalg.pyx":409 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) # <<<<<<<<<<<<<< @@ -3892,9 +4767,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p * fff_matrix_memcpy(d, c) */ if (!(likely(((__pyx_v_C) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_C, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_C)); + __pyx_t_1 = __pyx_v_C; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":410 + /* "nipy/labs/bindings/linalg.pyx":410 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(c.size1, c.size2) # <<<<<<<<<<<<<< @@ -3903,7 +4781,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ __pyx_v_d = fff_matrix_new(__pyx_v_c->size1, __pyx_v_c->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":411 + /* "nipy/labs/bindings/linalg.pyx":411 * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(c.size1, c.size2) * fff_matrix_memcpy(d, c) # <<<<<<<<<<<<<< @@ -3912,7 +4790,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ fff_matrix_memcpy(__pyx_v_d, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":412 + /* "nipy/labs/bindings/linalg.pyx":412 * d = fff_matrix_new(c.size1, c.size2) * fff_matrix_memcpy(d, c) * fff_blas_dgemm(flag_transpose(TransA), flag_transpose(TransB), alpha, a, b, beta, d) # <<<<<<<<<<<<<< @@ -3921,7 +4799,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ fff_blas_dgemm(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_TransA), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_TransB), __pyx_v_alpha, __pyx_v_a, __pyx_v_b, __pyx_v_beta, __pyx_v_d); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":413 + /* "nipy/labs/bindings/linalg.pyx":413 * fff_matrix_memcpy(d, c) * fff_blas_dgemm(flag_transpose(TransA), flag_transpose(TransB), alpha, a, b, beta, d) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -3930,7 +4808,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":414 + /* "nipy/labs/bindings/linalg.pyx":414 * fff_blas_dgemm(flag_transpose(TransA), flag_transpose(TransB), alpha, a, b, beta, d) * fff_matrix_delete(a) * fff_matrix_delete(b) # <<<<<<<<<<<<<< @@ -3939,7 +4817,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ fff_matrix_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":415 + /* "nipy/labs/bindings/linalg.pyx":415 * fff_matrix_delete(a) * fff_matrix_delete(b) * fff_matrix_delete(c) # <<<<<<<<<<<<<< @@ -3948,7 +4826,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ fff_matrix_delete(__pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":416 + /* "nipy/labs/bindings/linalg.pyx":416 * fff_matrix_delete(b) * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) # <<<<<<<<<<<<<< @@ -3957,11 +4835,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_D); - __pyx_v_D = __pyx_t_1; + __pyx_v_D = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":417 + /* "nipy/labs/bindings/linalg.pyx":417 * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) * return D # <<<<<<<<<<<<<< @@ -3969,34 +4846,28 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_D); - __pyx_r = __pyx_v_D; + __Pyx_INCREF(((PyObject *)__pyx_v_D)); + __pyx_r = ((PyObject *)__pyx_v_D); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dgemm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dgemm", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_D); + __Pyx_XDECREF((PyObject *)__pyx_v_D); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":420 - * - * - * def blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C): # <<<<<<<<<<<<<< - * """ - * D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C). - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsymm[] = "\n D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C).\n \n Compute the matrix-matrix product and sum C = lpha A B + eta C\n for Side is CblasLeft and C = lpha B A + eta C for Side is\n CblasRight, where the matrix A is symmetric. When Uplo is\n CblasUpper then the upper triangle and diagonal of A are used, and\n when Uplo is CblasLower then the lower triangle and diagonal of A\n are used.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_47blas_dsymm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_46blas_dsymm[] = "\n D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C).\n \n Compute the matrix-matrix product and sum C = \007lpha A B + \010eta C\n for Side is CblasLeft and C = \007lpha B A + \010eta C for Side is\n CblasRight, where the matrix A is symmetric. When Uplo is\n CblasUpper then the upper triangle and diagonal of A are used, and\n when Uplo is CblasLower then the lower triangle and diagonal of A\n are used.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_47blas_dsymm = {__Pyx_NAMESTR("blas_dsymm"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_47blas_dsymm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_46blas_dsymm)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_47blas_dsymm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_Side; int __pyx_v_Uplo; double __pyx_v_alpha; @@ -4004,75 +4875,75 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p PyObject *__pyx_v_B = 0; PyObject *__pyx_v_beta = 0; PyObject *__pyx_v_C = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - fff_matrix *__pyx_v_d; - PyObject *__pyx_v_D; - PyObject *__pyx_r = NULL; - double __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; - __Pyx_RefNannySetupContext("blas_dsymm"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dsymm (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dsymm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dsymm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_Side = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Uplo = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -4081,27 +4952,44 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p __pyx_v_B = values[4]; __pyx_v_beta = values[5]; __pyx_v_C = values[6]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_Side = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Uplo = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 4); - __pyx_v_beta = PyTuple_GET_ITEM(__pyx_args, 5); - __pyx_v_C = PyTuple_GET_ITEM(__pyx_args, 6); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dsymm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsymm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsymm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_D = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_46blas_dsymm(__pyx_self, __pyx_v_Side, __pyx_v_Uplo, __pyx_v_alpha, __pyx_v_A, __pyx_v_B, __pyx_v_beta, __pyx_v_C); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":420 + * + * + * def blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C). + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_46blas_dsymm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, PyObject *__pyx_v_beta, PyObject *__pyx_v_C) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + fff_matrix *__pyx_v_d; + PyArrayObject *__pyx_v_D = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + double __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dsymm", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":432 + /* "nipy/labs/bindings/linalg.pyx":432 * """ * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -4109,9 +4997,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p * c = fff_matrix_fromPyArray(C) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":433 + /* "nipy/labs/bindings/linalg.pyx":433 * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -4119,9 +5010,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p * d = fff_matrix_new(c.size1, c.size2) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":434 + /* "nipy/labs/bindings/linalg.pyx":434 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) # <<<<<<<<<<<<<< @@ -4129,9 +5023,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p * fff_matrix_memcpy(d, c) */ if (!(likely(((__pyx_v_C) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_C, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_C)); + __pyx_t_1 = __pyx_v_C; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":435 + /* "nipy/labs/bindings/linalg.pyx":435 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(c.size1, c.size2) # <<<<<<<<<<<<<< @@ -4140,7 +5037,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p */ __pyx_v_d = fff_matrix_new(__pyx_v_c->size1, __pyx_v_c->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":436 + /* "nipy/labs/bindings/linalg.pyx":436 * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(c.size1, c.size2) * fff_matrix_memcpy(d, c) # <<<<<<<<<<<<<< @@ -4149,17 +5046,17 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p */ fff_matrix_memcpy(__pyx_v_d, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":437 + /* "nipy/labs/bindings/linalg.pyx":437 * d = fff_matrix_new(c.size1, c.size2) * fff_matrix_memcpy(d, c) * fff_blas_dsymm(flag_side(Side), flag_uplo(Uplo), alpha, a, b, beta, d) # <<<<<<<<<<<<<< * fff_matrix_delete(a) * fff_matrix_delete(b) */ - __pyx_t_1 = __pyx_PyFloat_AsDouble(__pyx_v_beta); if (unlikely((__pyx_t_1 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - fff_blas_dsymm(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(__pyx_v_Side), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_v_alpha, __pyx_v_a, __pyx_v_b, __pyx_t_1, __pyx_v_d); + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_v_beta); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + fff_blas_dsymm(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(__pyx_v_Side), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_v_alpha, __pyx_v_a, __pyx_v_b, __pyx_t_2, __pyx_v_d); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":438 + /* "nipy/labs/bindings/linalg.pyx":438 * fff_matrix_memcpy(d, c) * fff_blas_dsymm(flag_side(Side), flag_uplo(Uplo), alpha, a, b, beta, d) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -4168,7 +5065,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":439 + /* "nipy/labs/bindings/linalg.pyx":439 * fff_blas_dsymm(flag_side(Side), flag_uplo(Uplo), alpha, a, b, beta, d) * fff_matrix_delete(a) * fff_matrix_delete(b) # <<<<<<<<<<<<<< @@ -4177,7 +5074,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p */ fff_matrix_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":440 + /* "nipy/labs/bindings/linalg.pyx":440 * fff_matrix_delete(a) * fff_matrix_delete(b) * fff_matrix_delete(c) # <<<<<<<<<<<<<< @@ -4186,20 +5083,19 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p */ fff_matrix_delete(__pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":441 + /* "nipy/labs/bindings/linalg.pyx":441 * fff_matrix_delete(b) * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) # <<<<<<<<<<<<<< * return D * */ - __pyx_t_2 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_d)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_D); - __pyx_v_D = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 441; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_D = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":442 + /* "nipy/labs/bindings/linalg.pyx":442 * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) * return D # <<<<<<<<<<<<<< @@ -4207,34 +5103,28 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm(PyObject *__p * def blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_D); - __pyx_r = __pyx_v_D; + __Pyx_INCREF(((PyObject *)__pyx_v_D)); + __pyx_r = ((PyObject *)__pyx_v_D); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsymm"); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsymm", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_D); + __Pyx_XDECREF((PyObject *)__pyx_v_D); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":444 - * return D - * - * def blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< - * """ - * C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dtrmm[] = "\n C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B).\n \n Compute the matrix-matrix product B = lpha op(A) B for Side\n is CblasLeft and B = lpha B op(A) for Side is CblasRight. The\n matrix A is triangular and op(A) = A, A^T, A^H for TransA =\n CblasNoTrans, CblasTrans, CblasConjTrans. When Uplo is CblasUpper\n then the upper triangle of A is used, and when Uplo is CblasLower\n then the lower triangle of A is used. If Diag is CblasNonUnit then\n the diagonal of A is used, but if Diag is CblasUnit then the\n diagonal elements of the matrix A are taken as unity and are not\n referenced.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_49blas_dtrmm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_48blas_dtrmm[] = "\n C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B).\n \n Compute the matrix-matrix product B = \007lpha op(A) B for Side\n is CblasLeft and B = \007lpha B op(A) for Side is CblasRight. The\n matrix A is triangular and op(A) = A, A^T, A^H for TransA =\n CblasNoTrans, CblasTrans, CblasConjTrans. When Uplo is CblasUpper\n then the upper triangle of A is used, and when Uplo is CblasLower\n then the lower triangle of A is used. If Diag is CblasNonUnit then\n the diagonal of A is used, but if Diag is CblasUnit then the\n diagonal elements of the matrix A are taken as unity and are not\n referenced.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_49blas_dtrmm = {__Pyx_NAMESTR("blas_dtrmm"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_49blas_dtrmm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_48blas_dtrmm)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_49blas_dtrmm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_Side; int __pyx_v_Uplo; int __pyx_v_TransA; @@ -4242,73 +5132,75 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p double __pyx_v_alpha; PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__TransA,&__pyx_n_s__Diag,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("blas_dtrmm"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dtrmm (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__TransA,&__pyx_n_s__Diag,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Diag); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Diag)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dtrmm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dtrmm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_Side = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Uplo = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -4317,27 +5209,42 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_A = values[5]; __pyx_v_B = values[6]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_Side = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Uplo = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_TransA = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_TransA == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Diag = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_Diag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 5); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 6); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dtrmm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrmm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrmm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_48blas_dtrmm(__pyx_self, __pyx_v_Side, __pyx_v_Uplo, __pyx_v_TransA, __pyx_v_Diag, __pyx_v_alpha, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":444 + * return D + * + * def blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_48blas_dtrmm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, int __pyx_v_TransA, int __pyx_v_Diag, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dtrmm", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":459 + /* "nipy/labs/bindings/linalg.pyx":459 * """ * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -4345,9 +5252,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p * c = fff_matrix_new(a.size1, a.size2) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":460 + /* "nipy/labs/bindings/linalg.pyx":460 * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -4355,9 +5265,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p * fff_matrix_memcpy(c, b) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 460; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":461 + /* "nipy/labs/bindings/linalg.pyx":461 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) # <<<<<<<<<<<<<< @@ -4366,7 +5279,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ __pyx_v_c = fff_matrix_new(__pyx_v_a->size1, __pyx_v_a->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":462 + /* "nipy/labs/bindings/linalg.pyx":462 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(c, b) # <<<<<<<<<<<<<< @@ -4375,7 +5288,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ fff_matrix_memcpy(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":464 + /* "nipy/labs/bindings/linalg.pyx":464 * fff_matrix_memcpy(c, b) * fff_blas_dtrmm(flag_side(Side), flag_uplo(Uplo), flag_transpose(TransA), flag_diag(Diag), * alpha, a, c) # <<<<<<<<<<<<<< @@ -4384,7 +5297,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ fff_blas_dtrmm(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(__pyx_v_Side), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_TransA), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(__pyx_v_Diag), __pyx_v_alpha, __pyx_v_a, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":465 + /* "nipy/labs/bindings/linalg.pyx":465 * fff_blas_dtrmm(flag_side(Side), flag_uplo(Uplo), flag_transpose(TransA), flag_diag(Diag), * alpha, a, c) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -4393,7 +5306,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":466 + /* "nipy/labs/bindings/linalg.pyx":466 * alpha, a, c) * fff_matrix_delete(a) * fff_matrix_delete(b) # <<<<<<<<<<<<<< @@ -4402,7 +5315,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ fff_matrix_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":467 + /* "nipy/labs/bindings/linalg.pyx":467 * fff_matrix_delete(a) * fff_matrix_delete(b) * C = fff_matrix_toPyArray(c) # <<<<<<<<<<<<<< @@ -4411,11 +5324,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":468 + /* "nipy/labs/bindings/linalg.pyx":468 * fff_matrix_delete(b) * C = fff_matrix_toPyArray(c) * return C # <<<<<<<<<<<<<< @@ -4423,34 +5335,28 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrmm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrmm", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":471 - * - * - * def blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< - * """ - * blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dtrsm[] = "\n blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B).\n \n Compute the inverse-matrix matrix product B = lpha\n op(inv(A))B for Side is CblasLeft and B = lpha B op(inv(A)) for\n Side is CblasRight. The matrix A is triangular and op(A) = A, A^T,\n A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans. When\n Uplo is CblasUpper then the upper triangle of A is used, and when\n Uplo is CblasLower then the lower triangle of A is used. If Diag\n is CblasNonUnit then the diagonal of A is used, but if Diag is\n CblasUnit then the diagonal elements of the matrix A are taken as\n unity and are not referenced.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_51blas_dtrsm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_50blas_dtrsm[] = "\n blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B).\n \n Compute the inverse-matrix matrix product B = \007lpha\n op(inv(A))B for Side is CblasLeft and B = \007lpha B op(inv(A)) for\n Side is CblasRight. The matrix A is triangular and op(A) = A, A^T,\n A^H for TransA = CblasNoTrans, CblasTrans, CblasConjTrans. When\n Uplo is CblasUpper then the upper triangle of A is used, and when\n Uplo is CblasLower then the lower triangle of A is used. If Diag\n is CblasNonUnit then the diagonal of A is used, but if Diag is\n CblasUnit then the diagonal elements of the matrix A are taken as\n unity and are not referenced.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_51blas_dtrsm = {__Pyx_NAMESTR("blas_dtrsm"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_51blas_dtrsm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_50blas_dtrsm)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_51blas_dtrsm(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_Side; int __pyx_v_Uplo; int __pyx_v_TransA; @@ -4458,73 +5364,75 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p double __pyx_v_alpha; PyObject *__pyx_v_A = 0; PyObject *__pyx_v_B = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - PyObject *__pyx_v_C; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__TransA,&__pyx_n_s__Diag,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,0}; - __Pyx_RefNannySetupContext("blas_dtrsm"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dtrsm (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Side,&__pyx_n_s__Uplo,&__pyx_n_s__TransA,&__pyx_n_s__Diag,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Diag); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Side)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__TransA)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Diag)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dtrsm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dtrsm") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_Side = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Uplo = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -4533,27 +5441,42 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_A = values[5]; __pyx_v_B = values[6]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_Side = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_Side == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Uplo = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_TransA = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_TransA == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Diag = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_Diag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 5); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 6); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dtrsm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrsm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrsm", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_50blas_dtrsm(__pyx_self, __pyx_v_Side, __pyx_v_Uplo, __pyx_v_TransA, __pyx_v_Diag, __pyx_v_alpha, __pyx_v_A, __pyx_v_B); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":471 + * + * + * def blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_50blas_dtrsm(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Side, int __pyx_v_Uplo, int __pyx_v_TransA, int __pyx_v_Diag, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + PyArrayObject *__pyx_v_C = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dtrsm", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":486 + /* "nipy/labs/bindings/linalg.pyx":486 * """ * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -4561,9 +5484,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p * c = fff_matrix_new(a.size1, a.size2) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":487 + /* "nipy/labs/bindings/linalg.pyx":487 * cdef fff_matrix *a, *b, *c * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -4571,9 +5497,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p * fff_matrix_memcpy(c, b) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":488 + /* "nipy/labs/bindings/linalg.pyx":488 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) # <<<<<<<<<<<<<< @@ -4582,7 +5511,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ __pyx_v_c = fff_matrix_new(__pyx_v_a->size1, __pyx_v_a->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":489 + /* "nipy/labs/bindings/linalg.pyx":489 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(c, b) # <<<<<<<<<<<<<< @@ -4591,7 +5520,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ fff_matrix_memcpy(__pyx_v_c, __pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":491 + /* "nipy/labs/bindings/linalg.pyx":491 * fff_matrix_memcpy(c, b) * fff_blas_dtrsm(flag_side(Side), flag_uplo(Uplo), flag_transpose(TransA), flag_diag(Diag), * alpha, a, c) # <<<<<<<<<<<<<< @@ -4600,7 +5529,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ fff_blas_dtrsm(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_side(__pyx_v_Side), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_TransA), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_diag(__pyx_v_Diag), __pyx_v_alpha, __pyx_v_a, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":492 + /* "nipy/labs/bindings/linalg.pyx":492 * fff_blas_dtrsm(flag_side(Side), flag_uplo(Uplo), flag_transpose(TransA), flag_diag(Diag), * alpha, a, c) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -4609,7 +5538,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":493 + /* "nipy/labs/bindings/linalg.pyx":493 * alpha, a, c) * fff_matrix_delete(a) * fff_matrix_delete(b) # <<<<<<<<<<<<<< @@ -4618,7 +5547,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ fff_matrix_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":494 + /* "nipy/labs/bindings/linalg.pyx":494 * fff_matrix_delete(a) * fff_matrix_delete(b) * C = fff_matrix_toPyArray(c) # <<<<<<<<<<<<<< @@ -4627,11 +5556,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_1; + __pyx_v_C = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":495 + /* "nipy/labs/bindings/linalg.pyx":495 * fff_matrix_delete(b) * C = fff_matrix_toPyArray(c) * return C # <<<<<<<<<<<<<< @@ -4639,100 +5567,96 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_C); - __pyx_r = __pyx_v_C; + __Pyx_INCREF(((PyObject *)__pyx_v_C)); + __pyx_r = ((PyObject *)__pyx_v_C); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrsm"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dtrsm", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_C); + __Pyx_XDECREF((PyObject *)__pyx_v_C); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":498 - * - * - * def blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C): # <<<<<<<<<<<<<< - * """ - * D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C). - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsyrk[] = "\n D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C).\n \n Compute a rank-k update of the symmetric matrix C, C = lpha A\n A^T + eta C when Trans is CblasNoTrans and C = lpha A^T A +\n eta C when Trans is CblasTrans. Since the matrix C is symmetric\n only its upper half or lower half need to be stored. When Uplo is\n CblasUpper then the upper triangle and diagonal of C are used, and\n when Uplo is CblasLower then the lower triangle and diagonal of C\n are used.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_53blas_dsyrk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_52blas_dsyrk[] = "\n D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C).\n \n Compute a rank-k update of the symmetric matrix C, C = \007lpha A\n A^T + \010eta C when Trans is CblasNoTrans and C = \007lpha A^T A +\n \010eta C when Trans is CblasTrans. Since the matrix C is symmetric\n only its upper half or lower half need to be stored. When Uplo is\n CblasUpper then the upper triangle and diagonal of C are used, and\n when Uplo is CblasLower then the lower triangle and diagonal of C\n are used.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_53blas_dsyrk = {__Pyx_NAMESTR("blas_dsyrk"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_53blas_dsyrk, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_52blas_dsyrk)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_53blas_dsyrk(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_Uplo; int __pyx_v_Trans; double __pyx_v_alpha; PyObject *__pyx_v_A = 0; double __pyx_v_beta; PyObject *__pyx_v_C = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_c; - fff_matrix *__pyx_v_d; - PyObject *__pyx_v_D; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Uplo,&__pyx_n_s__Trans,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__beta,&__pyx_n_s__C,0}; - __Pyx_RefNannySetupContext("blas_dsyrk"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dsyrk (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Uplo,&__pyx_n_s__Trans,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__beta,&__pyx_n_s__C,0}; PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Trans); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Trans)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dsyrk") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dsyrk") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); } __pyx_v_Uplo = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Trans = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_Trans == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -4740,26 +5664,42 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p __pyx_v_A = values[3]; __pyx_v_beta = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_C = values[5]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_Uplo = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Trans = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_Trans == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_beta = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = PyTuple_GET_ITEM(__pyx_args, 5); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dsyrk", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyrk"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyrk", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_D = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_52blas_dsyrk(__pyx_self, __pyx_v_Uplo, __pyx_v_Trans, __pyx_v_alpha, __pyx_v_A, __pyx_v_beta, __pyx_v_C); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":498 + * + * + * def blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C). + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_52blas_dsyrk(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Uplo, int __pyx_v_Trans, double __pyx_v_alpha, PyObject *__pyx_v_A, double __pyx_v_beta, PyObject *__pyx_v_C) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_c; + fff_matrix *__pyx_v_d; + PyArrayObject *__pyx_v_D = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dsyrk", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":511 + /* "nipy/labs/bindings/linalg.pyx":511 * """ * cdef fff_matrix *a, *c, *d * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -4767,9 +5707,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p * d = fff_matrix_new(a.size1, a.size2) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":512 + /* "nipy/labs/bindings/linalg.pyx":512 * cdef fff_matrix *a, *c, *d * a = fff_matrix_fromPyArray(A) * c = fff_matrix_fromPyArray(C) # <<<<<<<<<<<<<< @@ -4777,9 +5720,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p * fff_matrix_memcpy(d, c) */ if (!(likely(((__pyx_v_C) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_C, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_C)); + __pyx_t_1 = __pyx_v_C; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":513 + /* "nipy/labs/bindings/linalg.pyx":513 * a = fff_matrix_fromPyArray(A) * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(a.size1, a.size2) # <<<<<<<<<<<<<< @@ -4788,7 +5734,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ __pyx_v_d = fff_matrix_new(__pyx_v_a->size1, __pyx_v_a->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":514 + /* "nipy/labs/bindings/linalg.pyx":514 * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(d, c) # <<<<<<<<<<<<<< @@ -4797,7 +5743,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ fff_matrix_memcpy(__pyx_v_d, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":515 + /* "nipy/labs/bindings/linalg.pyx":515 * d = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(d, c) * fff_blas_dsyrk(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, beta, d) # <<<<<<<<<<<<<< @@ -4806,7 +5752,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ fff_blas_dsyrk(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_Trans), __pyx_v_alpha, __pyx_v_a, __pyx_v_beta, __pyx_v_d); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":516 + /* "nipy/labs/bindings/linalg.pyx":516 * fff_matrix_memcpy(d, c) * fff_blas_dsyrk(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, beta, d) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -4815,7 +5761,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":517 + /* "nipy/labs/bindings/linalg.pyx":517 * fff_blas_dsyrk(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, beta, d) * fff_matrix_delete(a) * fff_matrix_delete(c) # <<<<<<<<<<<<<< @@ -4824,7 +5770,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ fff_matrix_delete(__pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":518 + /* "nipy/labs/bindings/linalg.pyx":518 * fff_matrix_delete(a) * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) # <<<<<<<<<<<<<< @@ -4833,11 +5779,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_D); - __pyx_v_D = __pyx_t_1; + __pyx_v_D = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":519 + /* "nipy/labs/bindings/linalg.pyx":519 * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) * return D # <<<<<<<<<<<<<< @@ -4845,34 +5790,28 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk(PyObject *__p * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_D); - __pyx_r = __pyx_v_D; + __Pyx_INCREF(((PyObject *)__pyx_v_D)); + __pyx_r = ((PyObject *)__pyx_v_D); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyrk"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyrk", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_D); + __Pyx_XDECREF((PyObject *)__pyx_v_D); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":522 - * - * - * def blas_dsyr2k(int Uplo, int Trans, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< - * """ - * Compute a rank-2k update of the symmetric matrix C, C = \alpha A B^T + - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsyr2k[] = "\n Compute a rank-2k update of the symmetric matrix C, C = lpha A B^T +\n lpha B A^T + eta C when Trans is CblasNoTrans and C = lpha A^T B\n + lpha B^T A + eta C when Trans is CblasTrans. Since the matrix C\n is symmetric only its upper half or lower half need to be stored. When\n Uplo is CblasUpper then the upper triangle and diagonal of C are used,\n and when Uplo is CblasLower then the lower triangle and diagonal of C\n are used.\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_55blas_dsyr2k(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_6linalg_54blas_dsyr2k[] = "\n Compute a rank-2k update of the symmetric matrix C, C = \007lpha A B^T +\n \007lpha B A^T + \010eta C when Trans is CblasNoTrans and C = \007lpha A^T B\n + \007lpha B^T A + \010eta C when Trans is CblasTrans. Since the matrix C\n is symmetric only its upper half or lower half need to be stored. When\n Uplo is CblasUpper then the upper triangle and diagonal of C are used,\n and when Uplo is CblasLower then the lower triangle and diagonal of C\n are used.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_6linalg_55blas_dsyr2k = {__Pyx_NAMESTR("blas_dsyr2k"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_6linalg_55blas_dsyr2k, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_54blas_dsyr2k)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_6linalg_55blas_dsyr2k(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_v_Uplo; int __pyx_v_Trans; double __pyx_v_alpha; @@ -4880,74 +5819,75 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ PyObject *__pyx_v_B = 0; double __pyx_v_beta; PyObject *__pyx_v_C = 0; - fff_matrix *__pyx_v_a; - fff_matrix *__pyx_v_b; - fff_matrix *__pyx_v_c; - fff_matrix *__pyx_v_d; - PyObject *__pyx_v_D; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Uplo,&__pyx_n_s__Trans,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; - __Pyx_RefNannySetupContext("blas_dsyr2k"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("blas_dsyr2k (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Uplo,&__pyx_n_s__Trans,&__pyx_n_s__alpha,&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__beta,&__pyx_n_s__C,0}; PyObject* values[7] = {0,0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Trans); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 5: - values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); - if (likely(values[5])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Uplo)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Trans)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } } - case 6: - values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[6])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "blas_dsyr2k") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "blas_dsyr2k") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); } __pyx_v_Uplo = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Trans = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_Trans == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -4956,27 +5896,43 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ __pyx_v_B = values[4]; __pyx_v_beta = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_C = values[6]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_Uplo = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_Uplo == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_Trans = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_Trans == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_alpha = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_A = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 4); - __pyx_v_beta = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_C = PyTuple_GET_ITEM(__pyx_args, 6); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("blas_dsyr2k", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyr2k"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyr2k", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_D = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_6linalg_54blas_dsyr2k(__pyx_self, __pyx_v_Uplo, __pyx_v_Trans, __pyx_v_alpha, __pyx_v_A, __pyx_v_B, __pyx_v_beta, __pyx_v_C); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/linalg.pyx":522 + * + * + * def blas_dsyr2k(int Uplo, int Trans, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * Compute a rank-2k update of the symmetric matrix C, C = \alpha A B^T + + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_54blas_dsyr2k(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_v_Uplo, int __pyx_v_Trans, double __pyx_v_alpha, PyObject *__pyx_v_A, PyObject *__pyx_v_B, double __pyx_v_beta, PyObject *__pyx_v_C) { + fff_matrix *__pyx_v_a; + fff_matrix *__pyx_v_b; + fff_matrix *__pyx_v_c; + fff_matrix *__pyx_v_d; + PyArrayObject *__pyx_v_D = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("blas_dsyr2k", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":533 + /* "nipy/labs/bindings/linalg.pyx":533 * """ * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) # <<<<<<<<<<<<<< @@ -4984,9 +5940,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ * c = fff_matrix_fromPyArray(C) */ if (!(likely(((__pyx_v_A) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_A, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_A)); + __pyx_t_1 = __pyx_v_A; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_a = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":534 + /* "nipy/labs/bindings/linalg.pyx":534 * cdef fff_matrix *a, *b, *c, *d * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) # <<<<<<<<<<<<<< @@ -4994,9 +5953,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ * d = fff_matrix_new(a.size1, a.size2) */ if (!(likely(((__pyx_v_B) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_B, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_B)); + __pyx_t_1 = __pyx_v_B; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_b = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":535 + /* "nipy/labs/bindings/linalg.pyx":535 * a = fff_matrix_fromPyArray(A) * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) # <<<<<<<<<<<<<< @@ -5004,9 +5966,12 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ * fff_matrix_memcpy(d, c) */ if (!(likely(((__pyx_v_C) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_C, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_C)); + __pyx_t_1 = __pyx_v_C; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_c = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":536 + /* "nipy/labs/bindings/linalg.pyx":536 * b = fff_matrix_fromPyArray(B) * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(a.size1, a.size2) # <<<<<<<<<<<<<< @@ -5015,7 +5980,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ __pyx_v_d = fff_matrix_new(__pyx_v_a->size1, __pyx_v_a->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":537 + /* "nipy/labs/bindings/linalg.pyx":537 * c = fff_matrix_fromPyArray(C) * d = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(d, c) # <<<<<<<<<<<<<< @@ -5024,7 +5989,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ fff_matrix_memcpy(__pyx_v_d, __pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":538 + /* "nipy/labs/bindings/linalg.pyx":538 * d = fff_matrix_new(a.size1, a.size2) * fff_matrix_memcpy(d, c) * fff_blas_dsyr2k(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, b, beta, d) # <<<<<<<<<<<<<< @@ -5033,7 +5998,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ fff_blas_dsyr2k(__pyx_f_4nipy_4labs_8bindings_6linalg_flag_uplo(__pyx_v_Uplo), __pyx_f_4nipy_4labs_8bindings_6linalg_flag_transpose(__pyx_v_Trans), __pyx_v_alpha, __pyx_v_a, __pyx_v_b, __pyx_v_beta, __pyx_v_d); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":539 + /* "nipy/labs/bindings/linalg.pyx":539 * fff_matrix_memcpy(d, c) * fff_blas_dsyr2k(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, b, beta, d) * fff_matrix_delete(a) # <<<<<<<<<<<<<< @@ -5042,7 +6007,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ fff_matrix_delete(__pyx_v_a); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":540 + /* "nipy/labs/bindings/linalg.pyx":540 * fff_blas_dsyr2k(flag_uplo(Uplo), flag_transpose(Trans), alpha, a, b, beta, d) * fff_matrix_delete(a) * fff_matrix_delete(b) # <<<<<<<<<<<<<< @@ -5051,7 +6016,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ fff_matrix_delete(__pyx_v_b); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":541 + /* "nipy/labs/bindings/linalg.pyx":541 * fff_matrix_delete(a) * fff_matrix_delete(b) * fff_matrix_delete(c) # <<<<<<<<<<<<<< @@ -5060,7 +6025,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ fff_matrix_delete(__pyx_v_c); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":542 + /* "nipy/labs/bindings/linalg.pyx":542 * fff_matrix_delete(b) * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) # <<<<<<<<<<<<<< @@ -5069,11 +6034,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ */ __pyx_t_1 = ((PyObject *)fff_matrix_toPyArray(__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_D); - __pyx_v_D = __pyx_t_1; + __pyx_v_D = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":543 + /* "nipy/labs/bindings/linalg.pyx":543 * fff_matrix_delete(c) * D = fff_matrix_toPyArray(d) * return D # <<<<<<<<<<<<<< @@ -5081,24 +6045,35 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ * */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_D); - __pyx_r = __pyx_v_D; + __Pyx_INCREF(((PyObject *)__pyx_v_D)); + __pyx_r = ((PyObject *)__pyx_v_D); goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyr2k"); + __Pyx_AddTraceback("nipy.labs.bindings.linalg.blas_dsyr2k", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_D); + __Pyx_XDECREF((PyObject *)__pyx_v_D); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -5106,8 +6081,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k(PyObject *__ * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -5119,23 +6093,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -5143,7 +6136,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -5152,16 +6145,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -5171,7 +6164,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -5179,11 +6172,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -5192,9 +6185,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -5204,43 +6197,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -5250,142 +6237,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -5394,25 +6374,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -5421,17 +6401,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -5440,7 +6422,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -5456,7 +6438,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -5468,49 +6450,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -5521,50 +6504,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -5573,10 +6550,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -5586,10 +6563,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -5599,10 +6576,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -5612,10 +6589,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -5625,10 +6602,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -5638,10 +6615,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -5651,10 +6628,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -5664,10 +6641,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -5677,10 +6654,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -5690,10 +6667,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -5703,10 +6680,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -5716,10 +6693,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -5729,10 +6706,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -5742,10 +6719,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -5755,10 +6732,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -5768,10 +6745,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -5781,37 +6758,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -5820,7 +6797,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -5829,105 +6806,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -5935,11 +6921,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -5949,7 +6935,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -5957,15 +6943,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -5975,10 +6960,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -5986,7 +6975,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5996,7 +6985,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6004,7 +6993,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -6014,10 +7003,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -6025,7 +7018,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6035,7 +7028,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6043,7 +7036,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -6053,10 +7046,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -6064,7 +7061,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6074,7 +7071,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6082,7 +7079,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -6092,10 +7089,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -6103,7 +7104,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6113,7 +7114,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6121,7 +7122,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -6131,10 +7132,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -6142,7 +7147,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6152,7 +7157,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6160,7 +7165,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -6169,33 +7174,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -6204,7 +7209,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -6213,167 +7218,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -6381,16 +7413,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -6399,469 +7430,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -6874,24 +7884,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -6901,12 +7910,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -6916,7 +7924,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -6928,7 +7936,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -6937,7 +7945,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -6948,7 +7956,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -6957,7 +7965,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -6966,12 +7974,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -6981,11 +7987,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -6995,7 +8001,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -7010,7 +8016,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -7024,51 +8030,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("vector_get"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_get)}, - {__Pyx_NAMESTR("vector_set"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_set)}, - {__Pyx_NAMESTR("vector_set_all"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_set_all, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_set_all)}, - {__Pyx_NAMESTR("vector_scale"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_scale)}, - {__Pyx_NAMESTR("vector_add_constant"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add_constant, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_add_constant)}, - {__Pyx_NAMESTR("vector_add"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_add)}, - {__Pyx_NAMESTR("vector_sub"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sub, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sub)}, - {__Pyx_NAMESTR("vector_mul"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_mul, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_mul)}, - {__Pyx_NAMESTR("vector_div"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_div, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_div)}, - {__Pyx_NAMESTR("vector_sum"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sum, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sum)}, - {__Pyx_NAMESTR("vector_ssd"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_ssd, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_ssd)}, - {__Pyx_NAMESTR("vector_sad"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_sad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_sad)}, - {__Pyx_NAMESTR("vector_median"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_median, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_median)}, - {__Pyx_NAMESTR("vector_quantile"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_vector_quantile, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_vector_quantile)}, - {__Pyx_NAMESTR("matrix_get"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_get, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_get)}, - {__Pyx_NAMESTR("matrix_transpose"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_transpose, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_transpose)}, - {__Pyx_NAMESTR("matrix_add"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_matrix_add, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_matrix_add)}, - {__Pyx_NAMESTR("blas_dnrm2"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dnrm2, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("blas_dasum"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dasum, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("blas_ddot"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_ddot, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("blas_daxpy"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_daxpy, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("blas_dscal"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dscal, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("blas_dgemm"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dgemm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dgemm)}, - {__Pyx_NAMESTR("blas_dsymm"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsymm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsymm)}, - {__Pyx_NAMESTR("blas_dtrmm"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrmm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dtrmm)}, - {__Pyx_NAMESTR("blas_dtrsm"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dtrsm, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dtrsm)}, - {__Pyx_NAMESTR("blas_dsyrk"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyrk, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsyrk)}, - {__Pyx_NAMESTR("blas_dsyr2k"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_6linalg_blas_dsyr2k, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_6linalg_blas_dsyr2k)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("linalg"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -7080,15 +8055,18 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, + {&__pyx_n_s__D, __pyx_k__D, sizeof(__pyx_k__D), 0, 0, 1, 1}, {&__pyx_n_s__Diag, __pyx_k__Diag, sizeof(__pyx_k__Diag), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__Side, __pyx_k__Side, sizeof(__pyx_k__Side), 0, 0, 1, 1}, @@ -7099,46 +8077,1014 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, + {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__aij, __pyx_k__aij, sizeof(__pyx_k__aij), 0, 0, 1, 1}, {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, {&__pyx_n_s__beta, __pyx_k__beta, sizeof(__pyx_k__beta), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dasum, __pyx_k__blas_dasum, sizeof(__pyx_k__blas_dasum), 0, 0, 1, 1}, + {&__pyx_n_s__blas_daxpy, __pyx_k__blas_daxpy, sizeof(__pyx_k__blas_daxpy), 0, 0, 1, 1}, + {&__pyx_n_s__blas_ddot, __pyx_k__blas_ddot, sizeof(__pyx_k__blas_ddot), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dgemm, __pyx_k__blas_dgemm, sizeof(__pyx_k__blas_dgemm), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dnrm2, __pyx_k__blas_dnrm2, sizeof(__pyx_k__blas_dnrm2), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dscal, __pyx_k__blas_dscal, sizeof(__pyx_k__blas_dscal), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dsymm, __pyx_k__blas_dsymm, sizeof(__pyx_k__blas_dsymm), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dsyr2k, __pyx_k__blas_dsyr2k, sizeof(__pyx_k__blas_dsyr2k), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dsyrk, __pyx_k__blas_dsyrk, sizeof(__pyx_k__blas_dsyrk), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dtrmm, __pyx_k__blas_dtrmm, sizeof(__pyx_k__blas_dtrmm), 0, 0, 1, 1}, + {&__pyx_n_s__blas_dtrsm, __pyx_k__blas_dtrsm, sizeof(__pyx_k__blas_dtrsm), 0, 0, 1, 1}, + {&__pyx_n_s__c, __pyx_k__c, sizeof(__pyx_k__c), 0, 0, 1, 1}, + {&__pyx_n_s__d, __pyx_k__d, sizeof(__pyx_k__d), 0, 0, 1, 1}, {&__pyx_n_s__fixed, __pyx_k__fixed, sizeof(__pyx_k__fixed), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__interp, __pyx_k__interp, sizeof(__pyx_k__interp), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__matrix_add, __pyx_k__matrix_add, sizeof(__pyx_k__matrix_add), 0, 0, 1, 1}, + {&__pyx_n_s__matrix_get, __pyx_k__matrix_get, sizeof(__pyx_k__matrix_get), 0, 0, 1, 1}, + {&__pyx_n_s__matrix_transpose, __pyx_k__matrix_transpose, sizeof(__pyx_k__matrix_transpose), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__q, __pyx_k__q, sizeof(__pyx_k__q), 0, 0, 1, 1}, {&__pyx_n_s__r, __pyx_k__r, sizeof(__pyx_k__r), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__size1, __pyx_k__size1, sizeof(__pyx_k__size1), 0, 0, 1, 1}, - {&__pyx_n_s__size2, __pyx_k__size2, sizeof(__pyx_k__size2), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__s, __pyx_k__s, sizeof(__pyx_k__s), 0, 0, 1, 1}, + {&__pyx_n_s__vector_add, __pyx_k__vector_add, sizeof(__pyx_k__vector_add), 0, 0, 1, 1}, + {&__pyx_n_s__vector_add_constant, __pyx_k__vector_add_constant, sizeof(__pyx_k__vector_add_constant), 0, 0, 1, 1}, + {&__pyx_n_s__vector_div, __pyx_k__vector_div, sizeof(__pyx_k__vector_div), 0, 0, 1, 1}, + {&__pyx_n_s__vector_get, __pyx_k__vector_get, sizeof(__pyx_k__vector_get), 0, 0, 1, 1}, + {&__pyx_n_s__vector_median, __pyx_k__vector_median, sizeof(__pyx_k__vector_median), 0, 0, 1, 1}, + {&__pyx_n_s__vector_mul, __pyx_k__vector_mul, sizeof(__pyx_k__vector_mul), 0, 0, 1, 1}, + {&__pyx_n_s__vector_quantile, __pyx_k__vector_quantile, sizeof(__pyx_k__vector_quantile), 0, 0, 1, 1}, + {&__pyx_n_s__vector_sad, __pyx_k__vector_sad, sizeof(__pyx_k__vector_sad), 0, 0, 1, 1}, + {&__pyx_n_s__vector_scale, __pyx_k__vector_scale, sizeof(__pyx_k__vector_scale), 0, 0, 1, 1}, + {&__pyx_n_s__vector_set, __pyx_k__vector_set, sizeof(__pyx_k__vector_set), 0, 0, 1, 1}, + {&__pyx_n_s__vector_set_all, __pyx_k__vector_set_all, sizeof(__pyx_k__vector_set_all), 0, 0, 1, 1}, + {&__pyx_n_s__vector_ssd, __pyx_k__vector_ssd, sizeof(__pyx_k__vector_ssd), 0, 0, 1, 1}, + {&__pyx_n_s__vector_sub, __pyx_k__vector_sub, sizeof(__pyx_k__vector_sub), 0, 0, 1, 1}, + {&__pyx_n_s__vector_sum, __pyx_k__vector_sum, sizeof(__pyx_k__vector_sum), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__xi, __pyx_k__xi, sizeof(__pyx_k__xi), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/bindings/linalg.pyx":91 + * + * ## fff_vector.h + * def vector_get(X, size_t i): # <<<<<<<<<<<<<< + * """ + * Get i-th element. + */ + __pyx_k_tuple_15 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__xi)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__xi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__xi)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_get, 91, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":103 + * return xi + * + * def vector_set(X, size_t i, double a): # <<<<<<<<<<<<<< + * """ + * Set i-th element. + */ + __pyx_k_tuple_19 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_set, 103, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":117 + * return Y + * + * def vector_set_all(X, double a): # <<<<<<<<<<<<<< + * """ + * Set to a constant value. + */ + __pyx_k_tuple_21 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_set_all, 117, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":131 + * return Y + * + * def vector_scale(X, double a): # <<<<<<<<<<<<<< + * """ + * Multiply by a constant value. + */ + __pyx_k_tuple_23 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_scale, 131, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":145 + * return Y + * + * def vector_add_constant(X, double a): # <<<<<<<<<<<<<< + * """ + * Add a constant value. + */ + __pyx_k_tuple_25 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 1, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_25, 4, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + __pyx_k_codeobj_26 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_add_constant, 145, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":159 + * return Y + * + * def vector_add(X, Y): # <<<<<<<<<<<<<< + * """ + * Add two vectors. + */ + __pyx_k_tuple_27 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 1, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 4, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_27, 5, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + __pyx_k_codeobj_28 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_add, 159, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":175 + * return Z + * + * def vector_sub(X, Y): # <<<<<<<<<<<<<< + * """ + * Substract two vectors: x - y + */ + __pyx_k_tuple_29 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 4, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_29, 5, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); + __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_sub, 175, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":191 + * return Z + * + * def vector_mul(X, Y): # <<<<<<<<<<<<<< + * """ + * Element-wise multiplication. + */ + __pyx_k_tuple_31 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 1, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 4, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_31, 5, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_mul, 191, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":207 + * return Z + * + * def vector_div(X, Y): # <<<<<<<<<<<<<< + * """ + * Element-wise division. + */ + __pyx_k_tuple_33 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 1, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 4, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_33, 5, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_div, 207, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":224 + * + * + * def vector_sum(X): # <<<<<<<<<<<<<< + * """ + * Sum up array elements. + */ + __pyx_k_tuple_35 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_35); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_35, 2, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); + __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_sum, 224, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":236 + * return s + * + * def vector_ssd(X, double m=0, int fixed=1): # <<<<<<<<<<<<<< + * """ + * (Minimal) sum of squared differences. + */ + __pyx_k_tuple_37 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 1, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fixed)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 2, ((PyObject *)__pyx_n_s__fixed)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fixed)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 3, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_37, 4, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); + __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_ssd, 236, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":248 + * return s + * + * def vector_sad(X, double m=0): # <<<<<<<<<<<<<< + * """ + * Sum of absolute differences. + */ + __pyx_k_tuple_39 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, ((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_codeobj_40 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_sad, 248, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":260 + * return s + * + * def vector_median(X): # <<<<<<<<<<<<<< + * """ + * Median. + */ + __pyx_k_tuple_41 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__m)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 2, ((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__m)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_codeobj_42 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_median, 260, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":272 + * return m + * + * def vector_quantile(X, double r, int interp): # <<<<<<<<<<<<<< + * """ + * Quantile. + */ + __pyx_k_tuple_43 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_43); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__r)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 1, ((PyObject *)__pyx_n_s__r)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__r)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__interp)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 2, ((PyObject *)__pyx_n_s__interp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__interp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 3, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__q)); + PyTuple_SET_ITEM(__pyx_k_tuple_43, 4, ((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__q)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_43)); + __pyx_k_codeobj_44 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_43, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__vector_quantile, 272, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_44)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":286 + * + * ## fff_matrix.h + * def matrix_get(A, size_t i, size_t j): # <<<<<<<<<<<<<< + * """ + * Get (i,j) element. + */ + __pyx_k_tuple_45 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_45)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_45); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 1, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 2, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 3, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__aij)); + PyTuple_SET_ITEM(__pyx_k_tuple_45, 4, ((PyObject *)__pyx_n_s__aij)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__aij)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_45)); + __pyx_k_codeobj_46 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_45, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__matrix_get, 286, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_46)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":298 + * return aij + * + * def matrix_transpose(A): # <<<<<<<<<<<<<< + * """ + * Transpose a matrix. + */ + __pyx_k_tuple_47 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_47)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_47); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 1, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 2, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_47, 3, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_47)); + __pyx_k_codeobj_48 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_47, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__matrix_transpose, 298, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_48)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":311 + * return B + * + * def matrix_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = matrix_add(A, B) + */ + __pyx_k_tuple_49 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_49)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_49); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 2, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 3, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 4, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_49, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_49)); + __pyx_k_codeobj_50 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_49, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__matrix_add, 311, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_50)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":360 + * + * ### BLAS 1 + * def blas_dnrm2(X): # <<<<<<<<<<<<<< + * cdef fff_vector *x + * x = fff_vector_fromPyArray(X) + */ + __pyx_k_tuple_51 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_51)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_51); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_51, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_51, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_51)); + __pyx_k_codeobj_52 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_51, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dnrm2, 360, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_52)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":365 + * return fff_blas_dnrm2(x) + * + * def blas_dasum(X): # <<<<<<<<<<<<<< + * cdef fff_vector *x + * x = fff_vector_fromPyArray(X) + */ + __pyx_k_tuple_53 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_53)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_53); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_53, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_53, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_53)); + __pyx_k_codeobj_54 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_53, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dasum, 365, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_54)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":370 + * return fff_blas_dasum(x) + * + * def blas_ddot(X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + __pyx_k_tuple_55 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_55)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_55); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 1, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_55, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_55)); + __pyx_k_codeobj_56 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_55, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_ddot, 370, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_56)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":376 + * return fff_blas_ddot(x, y) + * + * def blas_daxpy(double alpha, X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y, *z + * x = fff_vector_fromPyArray(X) + */ + __pyx_k_tuple_57 = PyTuple_New(7); if (unlikely(!__pyx_k_tuple_57)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_57); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 0, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 1, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 2, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 3, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 4, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 5, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_57, 6, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_57)); + __pyx_k_codeobj_58 = (PyObject*)__Pyx_PyCode_New(3, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_57, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_daxpy, 376, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_58)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":386 + * return Z + * + * def blas_dscal(double alpha, X): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + __pyx_k_tuple_59 = PyTuple_New(5); if (unlikely(!__pyx_k_tuple_59)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_59); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 0, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 1, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 2, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_59, 4, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_59)); + __pyx_k_codeobj_60 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_59, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dscal, 386, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_60)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":398 + * + * ### BLAS 3 + * def blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C). + */ + __pyx_k_tuple_61 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_61)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_61); + __Pyx_INCREF(((PyObject *)__pyx_n_s__TransA)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 0, ((PyObject *)__pyx_n_s__TransA)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TransA)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__TransB)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 1, ((PyObject *)__pyx_n_s__TransB)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TransB)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 2, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 3, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 4, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__beta)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 5, ((PyObject *)__pyx_n_s__beta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__beta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 6, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 7, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 9, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 10, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_61, 11, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_61)); + __pyx_k_codeobj_62 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dgemm, 398, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_62)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":420 + * + * + * def blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C). + */ + __pyx_k_tuple_63 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_63)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_63); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Side)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 0, ((PyObject *)__pyx_n_s__Side)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Side)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Uplo)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 1, ((PyObject *)__pyx_n_s__Uplo)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Uplo)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 2, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 3, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 4, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__beta)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 5, ((PyObject *)__pyx_n_s__beta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__beta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 6, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 7, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 9, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 10, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_63, 11, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_63)); + __pyx_k_codeobj_64 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dsymm, 420, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_64)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":444 + * return D + * + * def blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + __pyx_k_tuple_65 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_65)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_65); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Side)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 0, ((PyObject *)__pyx_n_s__Side)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Side)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Uplo)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 1, ((PyObject *)__pyx_n_s__Uplo)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Uplo)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__TransA)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 2, ((PyObject *)__pyx_n_s__TransA)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TransA)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Diag)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 3, ((PyObject *)__pyx_n_s__Diag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Diag)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 4, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 5, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 6, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 7, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 9, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_65, 10, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_65)); + __pyx_k_codeobj_66 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dtrmm, 444, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_66)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":471 + * + * + * def blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + __pyx_k_tuple_67 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_67)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_67); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Side)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 0, ((PyObject *)__pyx_n_s__Side)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Side)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Uplo)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 1, ((PyObject *)__pyx_n_s__Uplo)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Uplo)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__TransA)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 2, ((PyObject *)__pyx_n_s__TransA)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__TransA)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Diag)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 3, ((PyObject *)__pyx_n_s__Diag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Diag)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 4, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 5, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 6, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 7, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 9, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_67, 10, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_67)); + __pyx_k_codeobj_68 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_67, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dtrsm, 471, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_68)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":498 + * + * + * def blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C). + */ + __pyx_k_tuple_69 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_69)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_69); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Uplo)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 0, ((PyObject *)__pyx_n_s__Uplo)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Uplo)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Trans)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 1, ((PyObject *)__pyx_n_s__Trans)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Trans)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 2, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 3, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__beta)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 4, ((PyObject *)__pyx_n_s__beta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__beta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 5, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 6, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 7, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 8, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_69, 9, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_69)); + __pyx_k_codeobj_70 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_69, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dsyrk, 498, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_70)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/linalg.pyx":522 + * + * + * def blas_dsyr2k(int Uplo, int Trans, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * Compute a rank-2k update of the symmetric matrix C, C = \alpha A B^T + + */ + __pyx_k_tuple_71 = PyTuple_New(12); if (unlikely(!__pyx_k_tuple_71)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_71); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Uplo)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 0, ((PyObject *)__pyx_n_s__Uplo)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Uplo)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Trans)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 1, ((PyObject *)__pyx_n_s__Trans)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Trans)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__alpha)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 2, ((PyObject *)__pyx_n_s__alpha)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__alpha)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 3, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 4, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__beta)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 5, ((PyObject *)__pyx_n_s__beta)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__beta)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 6, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 7, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 9, ((PyObject *)__pyx_n_s__c)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__d)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 10, ((PyObject *)__pyx_n_s__d)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__d)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__D)); + PyTuple_SET_ITEM(__pyx_k_tuple_71, 11, ((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__D)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_71)); + __pyx_k_codeobj_72 = (PyObject*)__Pyx_PyCode_New(7, 0, 12, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_71, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__blas_dsyr2k, 522, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_72)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -7159,8 +9105,8 @@ PyMODINIT_FUNC PyInit_linalg(void) #endif { PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -7168,14 +9114,19 @@ PyMODINIT_FUNC PyInit_linalg(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_linalg(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_linalg(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -7186,16 +9137,23 @@ PyMODINIT_FUNC PyInit_linalg(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("linalg"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("linalg"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.bindings.linalg")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.bindings.linalg", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -7204,28 +9162,39 @@ PyMODINIT_FUNC PyInit_linalg(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":10 + /* "nipy/labs/bindings/linalg.pyx":10 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * # Include fff */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":84 + /* "nipy/labs/bindings/linalg.pyx":84 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -7234,7 +9203,7 @@ PyMODINIT_FUNC PyInit_linalg(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":85 + /* "nipy/labs/bindings/linalg.pyx":85 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -7243,31 +9212,379 @@ PyMODINIT_FUNC PyInit_linalg(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/linalg.pyx":86 + /* "nipy/labs/bindings/linalg.pyx":86 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * # Binded routines */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/bindings/linalg.pyx":91 + * + * ## fff_vector.h + * def vector_get(X, size_t i): # <<<<<<<<<<<<<< + * """ + * Get i-th element. */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.bindings.linalg"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init nipy.labs.bindings.linalg"); + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_1vector_get, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_get, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":103 + * return xi + * + * def vector_set(X, size_t i, double a): # <<<<<<<<<<<<<< + * """ + * Set i-th element. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_3vector_set, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_set, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":117 + * return Y + * + * def vector_set_all(X, double a): # <<<<<<<<<<<<<< + * """ + * Set to a constant value. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_5vector_set_all, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_set_all, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":131 + * return Y + * + * def vector_scale(X, double a): # <<<<<<<<<<<<<< + * """ + * Multiply by a constant value. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_7vector_scale, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_scale, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":145 + * return Y + * + * def vector_add_constant(X, double a): # <<<<<<<<<<<<<< + * """ + * Add a constant value. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_9vector_add_constant, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_add_constant, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":159 + * return Y + * + * def vector_add(X, Y): # <<<<<<<<<<<<<< + * """ + * Add two vectors. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_11vector_add, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_add, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":175 + * return Z + * + * def vector_sub(X, Y): # <<<<<<<<<<<<<< + * """ + * Substract two vectors: x - y + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_13vector_sub, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_sub, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":191 + * return Z + * + * def vector_mul(X, Y): # <<<<<<<<<<<<<< + * """ + * Element-wise multiplication. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_15vector_mul, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_mul, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":207 + * return Z + * + * def vector_div(X, Y): # <<<<<<<<<<<<<< + * """ + * Element-wise division. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_17vector_div, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_div, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":224 + * + * + * def vector_sum(X): # <<<<<<<<<<<<<< + * """ + * Sum up array elements. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_19vector_sum, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_sum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":236 + * return s + * + * def vector_ssd(X, double m=0, int fixed=1): # <<<<<<<<<<<<<< + * """ + * (Minimal) sum of squared differences. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_21vector_ssd, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_ssd, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":248 + * return s + * + * def vector_sad(X, double m=0): # <<<<<<<<<<<<<< + * """ + * Sum of absolute differences. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_23vector_sad, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_sad, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":260 + * return s + * + * def vector_median(X): # <<<<<<<<<<<<<< + * """ + * Median. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_25vector_median, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_median, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":272 + * return m + * + * def vector_quantile(X, double r, int interp): # <<<<<<<<<<<<<< + * """ + * Quantile. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_27vector_quantile, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__vector_quantile, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":286 + * + * ## fff_matrix.h + * def matrix_get(A, size_t i, size_t j): # <<<<<<<<<<<<<< + * """ + * Get (i,j) element. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_29matrix_get, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__matrix_get, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":298 + * return aij + * + * def matrix_transpose(A): # <<<<<<<<<<<<<< + * """ + * Transpose a matrix. + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_31matrix_transpose, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__matrix_transpose, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 298; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":311 + * return B + * + * def matrix_add(A, B): # <<<<<<<<<<<<<< + * """ + * C = matrix_add(A, B) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_33matrix_add, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__matrix_add, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":360 + * + * ### BLAS 1 + * def blas_dnrm2(X): # <<<<<<<<<<<<<< + * cdef fff_vector *x + * x = fff_vector_fromPyArray(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_35blas_dnrm2, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dnrm2, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":365 + * return fff_blas_dnrm2(x) + * + * def blas_dasum(X): # <<<<<<<<<<<<<< + * cdef fff_vector *x + * x = fff_vector_fromPyArray(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_37blas_dasum, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dasum, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":370 + * return fff_blas_dasum(x) + * + * def blas_ddot(X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_39blas_ddot, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_ddot, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":376 + * return fff_blas_ddot(x, y) + * + * def blas_daxpy(double alpha, X, Y): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y, *z + * x = fff_vector_fromPyArray(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_41blas_daxpy, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_daxpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":386 + * return Z + * + * def blas_dscal(double alpha, X): # <<<<<<<<<<<<<< + * cdef fff_vector *x, *y + * x = fff_vector_fromPyArray(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_43blas_dscal, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dscal, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":398 + * + * ### BLAS 3 + * def blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dgemm(int TransA, int TransB, double alpha, A, B, double beta, C). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_45blas_dgemm, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dgemm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":420 + * + * + * def blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsymm(int Side, int Uplo, double alpha, A, B, beta, C). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_47blas_dsymm, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dsymm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":444 + * return D + * + * def blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * C = blas_dtrmm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_49blas_dtrmm, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dtrmm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":471 + * + * + * def blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B): # <<<<<<<<<<<<<< + * """ + * blas_dtrsm(int Side, int Uplo, int TransA, int Diag, double alpha, A, B). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_51blas_dtrsm, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dtrsm, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":498 + * + * + * def blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C): # <<<<<<<<<<<<<< + * """ + * D = blas_dsyrk(int Uplo, int Trans, double alpha, A, double beta, C). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_53blas_dsyrk, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dsyrk, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":522 + * + * + * def blas_dsyr2k(int Uplo, int Trans, double alpha, A, B, double beta, C): # <<<<<<<<<<<<<< + * """ + * Compute a rank-2k update of the symmetric matrix C, C = \alpha A B^T + + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_6linalg_55blas_dsyr2k, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__blas_dsyr2k, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/linalg.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * """ + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init nipy.labs.bindings.linalg", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init nipy.labs.bindings.linalg"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7278,29 +9595,22 @@ PyMODINIT_FUNC PyInit_linalg(void) #endif } -static const char *__pyx_filenames[] = { - "linalg.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; -} - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ static void __Pyx_RaiseArgtupleInvalid( const char* func_name, @@ -7310,8 +9620,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -7322,14 +9631,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -7344,55 +9662,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -7423,66 +9763,271 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; } } - return item; + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(); + return __Pyx_IterFinish(); } + return 0; } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -7492,17 +10037,53 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { goto bad; list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } @@ -7571,15 +10152,60 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -7646,160 +10272,60 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -7973,6 +10499,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -7994,9 +10539,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -8029,9 +10574,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -8064,9 +10609,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -8099,9 +10644,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -8134,9 +10679,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -8169,9 +10714,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -8183,24 +10728,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -8211,19 +10787,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -8232,54 +10812,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -8290,28 +10925,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -8319,11 +10971,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -8358,11 +11008,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/bindings/wrapper.c b/nipy/labs/bindings/wrapper.c index 0c645132e1..df127b8902 100644 --- a/nipy/labs/bindings/wrapper.c +++ b/nipy/labs/bindings/wrapper.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:43:55 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:34 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__bindings__wrapper #define __PYX_HAVE_API__nipy__labs__bindings__wrapper -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -162,120 +260,79 @@ #include "fff_matrix.h" #include "fff_array.h" #include "fffpy.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -286,8 +343,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -298,7 +353,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -306,52 +360,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "wrapper.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -372,20 +589,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -396,54 +640,84 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ -#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) +#define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -451,43 +725,60 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -501,7 +792,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -522,11 +812,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -537,7 +833,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -552,11 +851,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -567,14 +872,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -593,6 +896,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -605,72 +910,114 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.bindings.wrapper */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.bindings.wrapper' */ #define __Pyx_MODULE_NAME "nipy.labs.bindings.wrapper" int __pyx_module_is_main_nipy__labs__bindings__wrapper = 0; -/* Implementation of nipy.labs.bindings.wrapper */ +/* Implementation of 'nipy.labs.bindings.wrapper' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(CYTHON_UNUSED PyObject *__pyx_self, PyArray_Descr *__pyx_v_T); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_2npy_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_T); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_4pass_vector(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_6copy_vector(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X, int __pyx_v_flag); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_8pass_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_10pass_array(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_12pass_vector_via_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X, int __pyx_v_axis, int __pyx_v_niters); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_14copy_via_iterators(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, int __pyx_v_axis); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_16sum_via_iterators(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, int __pyx_v_axis); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nIterators for testing. \nAuthor: Alexis Roche, 2009.\n"; -static char __pyx_k_8[] = "0.1"; -static char __pyx_k_9[] = "unknown type"; -static char __pyx_k_10[] = "unsigned char"; -static char __pyx_k_11[] = "signed char"; -static char __pyx_k_12[] = "unsigned short"; -static char __pyx_k_13[] = "signed short"; -static char __pyx_k_14[] = "unsigned int"; -static char __pyx_k_15[] = "unsigned long"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nIterators for testing. \nAuthor: Alexis Roche, 2009.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_15[] = "unknown type"; +static char __pyx_k_16[] = "unsigned char"; +static char __pyx_k_17[] = "signed char"; +static char __pyx_k_18[] = "unsigned short"; +static char __pyx_k_19[] = "signed short"; +static char __pyx_k_20[] = "unsigned int"; +static char __pyx_k_21[] = "unsigned long"; +static char __pyx_k_24[] = "/Users/mb312/dev_trees/nipy/nipy/labs/bindings/wrapper.pyx"; +static char __pyx_k_25[] = "nipy.labs.bindings.wrapper"; +static char __pyx_k_38[] = "pass_vector_via_iterator"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; +static char __pyx_k__T[] = "T"; static char __pyx_k__X[] = "X"; static char __pyx_k__Y[] = "Y"; +static char __pyx_k__Z[] = "Z"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; @@ -679,158 +1026,204 @@ static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; static char __pyx_k__int[] = "int"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__Xdum[] = "Xdum"; static char __pyx_k__axis[] = "axis"; -static char __pyx_k__base[] = "base"; static char __pyx_k__copy[] = "copy"; static char __pyx_k__data[] = "data"; -static char __pyx_k__dimT[] = "dimT"; -static char __pyx_k__dimX[] = "dimX"; -static char __pyx_k__dimY[] = "dimY"; -static char __pyx_k__dimZ[] = "dimZ"; +static char __pyx_k__dims[] = "dims"; static char __pyx_k__flag[] = "flag"; static char __pyx_k__long[] = "long"; -static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__size[] = "size"; -static char __pyx_k__descr[] = "descr"; +static char __pyx_k__type[] = "type"; static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__fff_t[] = "fff_t"; static char __pyx_k__float[] = "float"; static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__multi[] = "multi"; +static char __pyx_k__npy_t[] = "npy_t"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__size1[] = "size1"; -static char __pyx_k__size2[] = "size2"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__double[] = "double"; static char __pyx_k__elsize[] = "elsize"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; +static char __pyx_k__nbytes[] = "nbytes"; static char __pyx_k__niters[] = "niters"; -static char __pyx_k__vector[] = "vector"; +static char __pyx_k__stride[] = "stride"; static char __pyx_k__c_types[] = "c_types"; static char __pyx_k__squeeze[] = "squeeze"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__datatype[] = "datatype"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__fff_type[] = "fff_type"; static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__npy_type[] = "npy_type"; static char __pyx_k__fff_types[] = "fff_types"; static char __pyx_k__npy_types[] = "npy_types"; +static char __pyx_k__relstride[] = "relstride"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__pass_array[] = "pass_array"; static char __pyx_k__zeros_like[] = "zeros_like"; static char __pyx_k____version__[] = "__version__"; +static char __pyx_k__copy_vector[] = "copy_vector"; +static char __pyx_k__pass_matrix[] = "pass_matrix"; +static char __pyx_k__pass_vector[] = "pass_vector"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__sum_via_iterators[] = "sum_via_iterators"; +static char __pyx_k__copy_via_iterators[] = "copy_via_iterators"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_s_10; -static PyObject *__pyx_kp_s_11; -static PyObject *__pyx_kp_s_12; -static PyObject *__pyx_kp_s_13; +static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_s_14; static PyObject *__pyx_kp_s_15; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_kp_s_18; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_kp_s_20; +static PyObject *__pyx_kp_s_21; +static PyObject *__pyx_kp_s_24; +static PyObject *__pyx_n_s_25; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_n_s_38; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s__Xdum; static PyObject *__pyx_n_s__Y; +static PyObject *__pyx_n_s__Z; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__axis; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__c_types; static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__copy_vector; +static PyObject *__pyx_n_s__copy_via_iterators; static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__datatype; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__dimT; -static PyObject *__pyx_n_s__dimX; -static PyObject *__pyx_n_s__dimY; -static PyObject *__pyx_n_s__dimZ; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; static PyObject *__pyx_n_s__elsize; +static PyObject *__pyx_n_s__fff_t; +static PyObject *__pyx_n_s__fff_type; static PyObject *__pyx_n_s__fff_types; -static PyObject *__pyx_n_s__fields; static PyObject *__pyx_n_s__flag; static PyObject *__pyx_n_s__float; -static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__index; static PyObject *__pyx_n_s__int; static PyObject *__pyx_n_s__itemsize; static PyObject *__pyx_n_s__long; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__multi; +static PyObject *__pyx_n_s__nbytes; static PyObject *__pyx_n_s__niters; static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__npy_t; +static PyObject *__pyx_n_s__npy_type; static PyObject *__pyx_n_s__npy_types; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__pass_array; +static PyObject *__pyx_n_s__pass_matrix; +static PyObject *__pyx_n_s__pass_vector; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__relstride; static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__size1; -static PyObject *__pyx_n_s__size2; static PyObject *__pyx_n_s__squeeze; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__vector; +static PyObject *__pyx_n_s__stride; +static PyObject *__pyx_n_s__sum_via_iterators; +static PyObject *__pyx_n_s__type; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__z; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_n_s__zeros_like; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":34 - * +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_32; +static PyObject *__pyx_k_tuple_34; +static PyObject *__pyx_k_tuple_36; +static PyObject *__pyx_k_tuple_39; +static PyObject *__pyx_k_tuple_41; +static PyObject *__pyx_k_codeobj_23; +static PyObject *__pyx_k_codeobj_27; +static PyObject *__pyx_k_codeobj_29; +static PyObject *__pyx_k_codeobj_31; +static PyObject *__pyx_k_codeobj_33; +static PyObject *__pyx_k_codeobj_35; +static PyObject *__pyx_k_codeobj_37; +static PyObject *__pyx_k_codeobj_40; +static PyObject *__pyx_k_codeobj_42; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_1fff_type(PyObject *__pyx_self, PyObject *__pyx_v_T); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_fff_type[] = "\n fff_t, nbytes = fff_type(T)\n\n T is a np.dtype instance. Return a tuple (str, int). \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_1fff_type = {__Pyx_NAMESTR("fff_type"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_1fff_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_fff_type)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_1fff_type(PyObject *__pyx_self, PyObject *__pyx_v_T) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("fff_type (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_dtype, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(__pyx_self, ((PyArray_Descr *)__pyx_v_T)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":34 + * * * def fff_type(dtype T): # <<<<<<<<<<<<<< * """ * fff_t, nbytes = fff_type(T) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__pyx_self, PyObject *__pyx_v_T); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_fff_type[] = "\n fff_t, nbytes = fff_type(T)\n\n T is a np.dtype instance. Return a tuple (str, int). \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__pyx_self, PyObject *__pyx_v_T) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(CYTHON_UNUSED PyObject *__pyx_self, PyArray_Descr *__pyx_v_T) { fff_datatype __pyx_v_fff_t; unsigned int __pyx_v_nbytes; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("fff_type"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_T), __pyx_ptype_5numpy_dtype, 1, "T", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("fff_type", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":42 + /* "nipy/labs/bindings/wrapper.pyx":42 * cdef fff_datatype fff_t * cdef unsigned int nbytes * fff_t = fff_datatype_fromNumPy(T.type_num) # <<<<<<<<<<<<<< * nbytes = fff_nbytes(fff_t) * return c_types[fff_types.index(fff_t)], nbytes */ - __pyx_v_fff_t = fff_datatype_fromNumPy(((PyArray_Descr *)__pyx_v_T)->type_num); + __pyx_v_fff_t = fff_datatype_fromNumPy(__pyx_v_T->type_num); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":43 + /* "nipy/labs/bindings/wrapper.pyx":43 * cdef unsigned int nbytes * fff_t = fff_datatype_fromNumPy(T.type_num) * nbytes = fff_nbytes(fff_t) # <<<<<<<<<<<<<< @@ -839,7 +1232,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py */ __pyx_v_nbytes = fff_nbytes(__pyx_v_fff_t); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":44 + /* "nipy/labs/bindings/wrapper.pyx":44 * fff_t = fff_datatype_fromNumPy(T.type_num) * nbytes = fff_nbytes(fff_t) * return c_types[fff_types.index(fff_t)], nbytes # <<<<<<<<<<<<<< @@ -861,10 +1254,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_4 = PyObject_GetItem(__pyx_t_1, __pyx_t_2); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -879,7 +1272,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py __Pyx_GIVEREF(__pyx_t_2); __pyx_t_4 = 0; __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; + __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -890,7 +1283,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.fff_type"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.fff_type", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -898,7 +1291,20 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":47 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_3npy_type(PyObject *__pyx_self, PyObject *__pyx_v_T); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_2npy_type[] = "\n npy_t, nbytes = npy_type(T)\n\n T is a string. Return a tuple (str, int). \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_3npy_type = {__Pyx_NAMESTR("npy_type"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_3npy_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_2npy_type)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_3npy_type(PyObject *__pyx_self, PyObject *__pyx_v_T) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("npy_type (wrapper)", 0); + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_2npy_type(__pyx_self, ((PyObject *)__pyx_v_T)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":47 * * * def npy_type(T): # <<<<<<<<<<<<<< @@ -906,22 +1312,23 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type(PyObject *__py * npy_t, nbytes = npy_type(T) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__pyx_self, PyObject *__pyx_v_T); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_npy_type[] = "\n npy_t, nbytes = npy_type(T)\n\n T is a string. Return a tuple (str, int). \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__pyx_self, PyObject *__pyx_v_T) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_2npy_type(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_T) { int __pyx_v_npy_t; fff_datatype __pyx_v_fff_t; unsigned int __pyx_v_nbytes; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; fff_datatype __pyx_t_5; - __Pyx_RefNannySetupContext("npy_type"); - __pyx_self = __pyx_self; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("npy_type", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":56 + /* "nipy/labs/bindings/wrapper.pyx":56 * cdef fff_datatype fff_t * cdef unsigned int nbytes * fff_t = fff_types[c_types.index(T)] # <<<<<<<<<<<<<< @@ -940,10 +1347,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py __Pyx_INCREF(__pyx_v_T); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_T); __Pyx_GIVEREF(__pyx_v_T); - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_t_4); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -952,7 +1359,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_fff_t = ((fff_datatype)__pyx_t_5); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":57 + /* "nipy/labs/bindings/wrapper.pyx":57 * cdef unsigned int nbytes * fff_t = fff_types[c_types.index(T)] * npy_t = fff_datatype_toNumPy(fff_t) # <<<<<<<<<<<<<< @@ -961,7 +1368,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py */ __pyx_v_npy_t = fff_datatype_toNumPy(__pyx_v_fff_t); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":58 + /* "nipy/labs/bindings/wrapper.pyx":58 * fff_t = fff_types[c_types.index(T)] * npy_t = fff_datatype_toNumPy(fff_t) * nbytes = fff_nbytes(fff_t) # <<<<<<<<<<<<<< @@ -970,7 +1377,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py */ __pyx_v_nbytes = fff_nbytes(__pyx_v_fff_t); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":59 + /* "nipy/labs/bindings/wrapper.pyx":59 * npy_t = fff_datatype_toNumPy(fff_t) * nbytes = fff_nbytes(fff_t) * return c_types[npy_types.index(npy_t)], nbytes # <<<<<<<<<<<<<< @@ -992,10 +1399,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetItem(__pyx_t_2, __pyx_t_4); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -1010,7 +1417,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_r = __pyx_t_2; + __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -1021,7 +1428,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.npy_type"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.npy_type", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1029,7 +1436,25 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":61 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_5pass_vector(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_4pass_vector[] = "\n Y = pass_vector(X)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_5pass_vector = {__Pyx_NAMESTR("pass_vector"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_5pass_vector, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_4pass_vector)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_5pass_vector(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pass_vector (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_4pass_vector(__pyx_self, ((PyArrayObject *)__pyx_v_X)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":61 * return c_types[npy_types.index(npy_t)], nbytes * * def pass_vector(ndarray X): # <<<<<<<<<<<<<< @@ -1037,27 +1462,27 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type(PyObject *__py * Y = pass_vector(X) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_vector[] = "\n Y = pass_vector(X)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_4pass_vector(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X) { fff_vector *__pyx_v_x; fff_vector *__pyx_v_y; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("pass_vector"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pass_vector", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":66 + /* "nipy/labs/bindings/wrapper.pyx":66 * """ * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) # <<<<<<<<<<<<<< * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) */ - __pyx_v_x = fff_vector_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_v_x = fff_vector_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":67 + /* "nipy/labs/bindings/wrapper.pyx":67 * cdef fff_vector *x, *y * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1066,7 +1491,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":68 + /* "nipy/labs/bindings/wrapper.pyx":68 * x = fff_vector_fromPyArray(X) * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1075,7 +1500,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":69 + /* "nipy/labs/bindings/wrapper.pyx":69 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fff_vector_delete(x) # <<<<<<<<<<<<<< @@ -1084,7 +1509,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ */ fff_vector_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":70 + /* "nipy/labs/bindings/wrapper.pyx":70 * fff_vector_memcpy(y, x) * fff_vector_delete(x) * return fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1102,7 +1527,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1110,7 +1535,70 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":73 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_7copy_vector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_6copy_vector[] = "\n Y = copy_vector(X, flag)\n\n flag == 0 ==> use fff\n flag == 1 ==> use numpy\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_7copy_vector = {__Pyx_NAMESTR("copy_vector"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_7copy_vector, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_6copy_vector)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_7copy_vector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + int __pyx_v_flag; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_vector (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__flag,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flag)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("copy_vector", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_vector") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_flag = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("copy_vector", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_6copy_vector(__pyx_self, __pyx_v_X, __pyx_v_flag); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":73 * * * def copy_vector(ndarray X, int flag): # <<<<<<<<<<<<<< @@ -1118,11 +1606,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector(PyObject *_ * Y = copy_vector(X, flag) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_copy_vector[] = "\n Y = copy_vector(X, flag)\n\n flag == 0 ==> use fff\n flag == 1 ==> use numpy\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_X = 0; - int __pyx_v_flag; +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_6copy_vector(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X, int __pyx_v_flag) { fff_vector *__pyx_v_y; void *__pyx_v_data; int __pyx_v_size; @@ -1132,55 +1616,16 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ int __pyx_v_itemsize; fff_datatype __pyx_v_fff_type; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; int __pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__flag,0}; - __Pyx_RefNannySetupContext("copy_vector"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__flag); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("copy_vector", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "copy_vector") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_X = ((PyArrayObject *)values[0]); - __pyx_v_flag = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_flag = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_flag == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("copy_vector", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_vector"); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_X); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_vector", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":85 + /* "nipy/labs/bindings/wrapper.pyx":85 * cdef fff_datatype fff_type * * data = X.data # <<<<<<<<<<<<<< @@ -1189,7 +1634,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ __pyx_v_data = ((void *)__pyx_v_X->data); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":86 + /* "nipy/labs/bindings/wrapper.pyx":86 * * data = X.data * size = X.shape[0] # <<<<<<<<<<<<<< @@ -1198,7 +1643,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ __pyx_v_size = (__pyx_v_X->dimensions[0]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":87 + /* "nipy/labs/bindings/wrapper.pyx":87 * data = X.data * size = X.shape[0] * stride = X.strides[0] # <<<<<<<<<<<<<< @@ -1207,7 +1652,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ __pyx_v_stride = (__pyx_v_X->strides[0]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":88 + /* "nipy/labs/bindings/wrapper.pyx":88 * size = X.shape[0] * stride = X.strides[0] * itemsize = X.descr.elsize # <<<<<<<<<<<<<< @@ -1220,16 +1665,17 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_itemsize = __pyx_t_2; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":89 + /* "nipy/labs/bindings/wrapper.pyx":89 * stride = X.strides[0] * itemsize = X.descr.elsize * type = X.descr.type_num # <<<<<<<<<<<<<< * * relstride = stride/itemsize */ - __pyx_v_type = __pyx_v_X->descr->type_num; + __pyx_t_2 = __pyx_v_X->descr->type_num; + __pyx_v_type = __pyx_t_2; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":91 + /* "nipy/labs/bindings/wrapper.pyx":91 * type = X.descr.type_num * * relstride = stride/itemsize # <<<<<<<<<<<<<< @@ -1246,7 +1692,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ } __pyx_v_relstride = __Pyx_div_int(__pyx_v_stride, __pyx_v_itemsize); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":92 + /* "nipy/labs/bindings/wrapper.pyx":92 * * relstride = stride/itemsize * fff_type = fff_datatype_fromNumPy(type) # <<<<<<<<<<<<<< @@ -1255,7 +1701,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ __pyx_v_fff_type = fff_datatype_fromNumPy(__pyx_v_type); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":94 + /* "nipy/labs/bindings/wrapper.pyx":94 * fff_type = fff_datatype_fromNumPy(type) * * y = fff_vector_new(size) # <<<<<<<<<<<<<< @@ -1264,7 +1710,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ __pyx_v_y = fff_vector_new(__pyx_v_size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":96 + /* "nipy/labs/bindings/wrapper.pyx":96 * y = fff_vector_new(size) * * if flag == 0: # <<<<<<<<<<<<<< @@ -1274,7 +1720,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ __pyx_t_3 = (__pyx_v_flag == 0); if (__pyx_t_3) { - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":97 + /* "nipy/labs/bindings/wrapper.pyx":97 * * if flag == 0: * fff_vector_fetch(y, data, fff_type, relstride) # <<<<<<<<<<<<<< @@ -1282,11 +1728,11 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ * fff_vector_fetch_using_NumPy(y, data, stride, type, itemsize) */ fff_vector_fetch(__pyx_v_y, __pyx_v_data, __pyx_v_fff_type, __pyx_v_relstride); - goto __pyx_L6; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":99 + /* "nipy/labs/bindings/wrapper.pyx":99 * fff_vector_fetch(y, data, fff_type, relstride) * else: * fff_vector_fetch_using_NumPy(y, data, stride, type, itemsize) # <<<<<<<<<<<<<< @@ -1295,9 +1741,9 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ */ fff_vector_fetch_using_NumPy(__pyx_v_y, ((char *)__pyx_v_data), __pyx_v_stride, __pyx_v_type, __pyx_v_itemsize); } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":101 + /* "nipy/labs/bindings/wrapper.pyx":101 * fff_vector_fetch_using_NumPy(y, data, stride, type, itemsize) * * return fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1315,16 +1761,33 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_vector"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_vector", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_X); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":104 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_9pass_matrix(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_8pass_matrix[] = "\n Y = pass_matrix(X)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_9pass_matrix = {__Pyx_NAMESTR("pass_matrix"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_9pass_matrix, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_8pass_matrix)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_9pass_matrix(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pass_matrix (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_8pass_matrix(__pyx_self, ((PyArrayObject *)__pyx_v_X)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":104 * * * def pass_matrix(ndarray X): # <<<<<<<<<<<<<< @@ -1332,27 +1795,27 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector(PyObject *_ * Y = pass_matrix(X) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_matrix[] = "\n Y = pass_matrix(X)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_8pass_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X) { fff_matrix *__pyx_v_x; fff_matrix *__pyx_v_y; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("pass_matrix"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pass_matrix", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":109 + /* "nipy/labs/bindings/wrapper.pyx":109 * """ * cdef fff_matrix *x, *y * x = fff_matrix_fromPyArray(X) # <<<<<<<<<<<<<< * y = fff_matrix_new(x.size1, x.size2) * fff_matrix_memcpy(y, x) */ - __pyx_v_x = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_v_x = fff_matrix_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":110 + /* "nipy/labs/bindings/wrapper.pyx":110 * cdef fff_matrix *x, *y * x = fff_matrix_fromPyArray(X) * y = fff_matrix_new(x.size1, x.size2) # <<<<<<<<<<<<<< @@ -1361,7 +1824,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ */ __pyx_v_y = fff_matrix_new(__pyx_v_x->size1, __pyx_v_x->size2); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":111 + /* "nipy/labs/bindings/wrapper.pyx":111 * x = fff_matrix_fromPyArray(X) * y = fff_matrix_new(x.size1, x.size2) * fff_matrix_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1370,7 +1833,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ */ fff_matrix_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":112 + /* "nipy/labs/bindings/wrapper.pyx":112 * y = fff_matrix_new(x.size1, x.size2) * fff_matrix_memcpy(y, x) * fff_matrix_delete(x) # <<<<<<<<<<<<<< @@ -1379,7 +1842,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ */ fff_matrix_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":113 + /* "nipy/labs/bindings/wrapper.pyx":113 * fff_matrix_memcpy(y, x) * fff_matrix_delete(x) * return fff_matrix_toPyArray(y) # <<<<<<<<<<<<<< @@ -1397,7 +1860,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_matrix"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1405,7 +1868,25 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":116 +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_11pass_array(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_10pass_array[] = "\n Y = pass_array(X)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_11pass_array = {__Pyx_NAMESTR("pass_array"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_11pass_array, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_10pass_array)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_11pass_array(PyObject *__pyx_self, PyObject *__pyx_v_X) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pass_array (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_10pass_array(__pyx_self, ((PyArrayObject *)__pyx_v_X)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":116 * * * def pass_array(ndarray X): # <<<<<<<<<<<<<< @@ -1413,27 +1894,27 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix(PyObject *_ * Y = pass_array(X) */ -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__pyx_self, PyObject *__pyx_v_X); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_array[] = "\n Y = pass_array(X)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__pyx_self, PyObject *__pyx_v_X) { +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_10pass_array(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X) { fff_array *__pyx_v_x; fff_array *__pyx_v_y; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("pass_array"); - __pyx_self = __pyx_self; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pass_array", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":121 + /* "nipy/labs/bindings/wrapper.pyx":121 * """ * cdef fff_array *x, *y * x = fff_array_fromPyArray(X) # <<<<<<<<<<<<<< * y = fff_array_new(x.datatype, x.dimX, x.dimY, x.dimZ, x.dimT) * fff_array_copy(y, x) */ - __pyx_v_x = fff_array_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_v_x = fff_array_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":122 + /* "nipy/labs/bindings/wrapper.pyx":122 * cdef fff_array *x, *y * x = fff_array_fromPyArray(X) * y = fff_array_new(x.datatype, x.dimX, x.dimY, x.dimZ, x.dimT) # <<<<<<<<<<<<<< @@ -1442,7 +1923,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__ */ __pyx_v_y = fff_array_new(__pyx_v_x->datatype, __pyx_v_x->dimX, __pyx_v_x->dimY, __pyx_v_x->dimZ, __pyx_v_x->dimT); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":123 + /* "nipy/labs/bindings/wrapper.pyx":123 * x = fff_array_fromPyArray(X) * y = fff_array_new(x.datatype, x.dimX, x.dimY, x.dimZ, x.dimT) * fff_array_copy(y, x) # <<<<<<<<<<<<<< @@ -1451,7 +1932,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__ */ fff_array_copy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":124 + /* "nipy/labs/bindings/wrapper.pyx":124 * y = fff_array_new(x.datatype, x.dimX, x.dimY, x.dimZ, x.dimT) * fff_array_copy(y, x) * fff_array_delete(x) # <<<<<<<<<<<<<< @@ -1460,7 +1941,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__ */ fff_array_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":125 + /* "nipy/labs/bindings/wrapper.pyx":125 * fff_array_copy(y, x) * fff_array_delete(x) * return fff_array_toPyArray(y) # <<<<<<<<<<<<<< @@ -1478,7 +1959,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_array"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_array", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1486,59 +1967,57 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array(PyObject *__ return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":128 - * - * - * def pass_vector_via_iterator(ndarray X, int axis=0, int niters=0): # <<<<<<<<<<<<<< - * """ - * Y = pass_vector_via_iterator(X, axis=0, niters=0) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterator[] = "\n Y = pass_vector_via_iterator(X, axis=0, niters=0)\n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_13pass_vector_via_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_12pass_vector_via_iterator[] = "\n Y = pass_vector_via_iterator(X, axis=0, niters=0)\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_13pass_vector_via_iterator = {__Pyx_NAMESTR("pass_vector_via_iterator"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_13pass_vector_via_iterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_12pass_vector_via_iterator)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_13pass_vector_via_iterator(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; int __pyx_v_axis; int __pyx_v_niters; - fff_vector *__pyx_v_x; - fff_vector *__pyx_v_y; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_Xdum; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__axis,&__pyx_n_s__niters,0}; - __Pyx_RefNannySetupContext("pass_vector_via_iterator"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pass_vector_via_iterator (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__axis,&__pyx_n_s__niters,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niters); + if (value) { values[2] = value; kw_args--; } + } } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niters); - if (unlikely(value)) { values[2] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pass_vector_via_iterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pass_vector_via_iterator") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_X = ((PyArrayObject *)values[0]); if (values[1]) { @@ -1551,29 +2030,49 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato } else { __pyx_v_niters = ((int)0); } - } else { - __pyx_v_axis = ((int)0); - __pyx_v_niters = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: __pyx_v_niters = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_niters == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("pass_vector_via_iterator", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector_via_iterator"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector_via_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_X); - __pyx_v_Xdum = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_12pass_vector_via_iterator(__pyx_self, __pyx_v_X, __pyx_v_axis, __pyx_v_niters); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":128 + * + * + * def pass_vector_via_iterator(ndarray X, int axis=0, int niters=0): # <<<<<<<<<<<<<< + * """ + * Y = pass_vector_via_iterator(X, axis=0, niters=0) + */ + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_12pass_vector_via_iterator(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_X, int __pyx_v_axis, int __pyx_v_niters) { + fff_vector *__pyx_v_x; + fff_vector *__pyx_v_y; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_Xdum = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pass_vector_via_iterator", 0); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":135 + /* "nipy/labs/bindings/wrapper.pyx":135 * cdef fffpy_multi_iterator* multi * * Xdum = X.copy() ## at least two arrays needed for multi iterator # <<<<<<<<<<<<<< @@ -1585,11 +2084,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_Xdum); __pyx_v_Xdum = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":136 + /* "nipy/labs/bindings/wrapper.pyx":136 * * Xdum = X.copy() ## at least two arrays needed for multi iterator * multi = fffpy_multi_iterator_new(2, axis, X, Xdum) # <<<<<<<<<<<<<< @@ -1598,7 +2096,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato */ __pyx_v_multi = fffpy_multi_iterator_new(2, __pyx_v_axis, ((void *)__pyx_v_X), ((void *)__pyx_v_Xdum)); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":137 + /* "nipy/labs/bindings/wrapper.pyx":137 * Xdum = X.copy() ## at least two arrays needed for multi iterator * multi = fffpy_multi_iterator_new(2, axis, X, Xdum) * x = multi.vector[0] # <<<<<<<<<<<<<< @@ -1607,7 +2105,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato */ __pyx_v_x = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":139 + /* "nipy/labs/bindings/wrapper.pyx":139 * x = multi.vector[0] * * while(multi.index < niters): # <<<<<<<<<<<<<< @@ -1618,7 +2116,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato __pyx_t_3 = (__pyx_v_multi->index < __pyx_v_niters); if (!__pyx_t_3) break; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":140 + /* "nipy/labs/bindings/wrapper.pyx":140 * * while(multi.index < niters): * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1628,7 +2126,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":142 + /* "nipy/labs/bindings/wrapper.pyx":142 * fffpy_multi_iterator_update(multi) * * y = fff_vector_new(x.size) # <<<<<<<<<<<<<< @@ -1637,7 +2135,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato */ __pyx_v_y = fff_vector_new(__pyx_v_x->size); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":143 + /* "nipy/labs/bindings/wrapper.pyx":143 * * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) # <<<<<<<<<<<<<< @@ -1646,7 +2144,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato */ fff_vector_memcpy(__pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":144 + /* "nipy/labs/bindings/wrapper.pyx":144 * y = fff_vector_new(x.size) * fff_vector_memcpy(y, x) * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1655,7 +2153,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":145 + /* "nipy/labs/bindings/wrapper.pyx":145 * fff_vector_memcpy(y, x) * fffpy_multi_iterator_delete(multi) * return fff_vector_toPyArray(y) # <<<<<<<<<<<<<< @@ -1674,65 +2172,58 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterato __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector_via_iterator"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.pass_vector_via_iterator", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Xdum); - __Pyx_DECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF(__pyx_v_Xdum); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":148 - * - * - * def copy_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< - * """ - * Z = copy_via_iterators(Y, int axis=0) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_copy_via_iterators[] = "\n Z = copy_via_iterators(Y, int axis=0) \n\n Copy array Y into Z via fff's PyArray_MultiIterAllButAxis C function.\n Behavior should be equivalent to Z = Y.copy(). \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_15copy_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_14copy_via_iterators[] = "\n Z = copy_via_iterators(Y, int axis=0) \n\n Copy array Y into Z via fff's PyArray_MultiIterAllButAxis C function.\n Behavior should be equivalent to Z = Y.copy(). \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_15copy_via_iterators = {__Pyx_NAMESTR("copy_via_iterators"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_15copy_via_iterators, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_14copy_via_iterators)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_15copy_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; int __pyx_v_axis; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_Z; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("copy_via_iterators"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("copy_via_iterators (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__axis,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "copy_via_iterators") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "copy_via_iterators") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_Y = ((PyArrayObject *)values[0]); if (values[1]) { @@ -1740,27 +2231,52 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb } else { __pyx_v_axis = ((int)0); } - } else { - __pyx_v_axis = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("copy_via_iterators", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_via_iterators"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_via_iterators", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_14copy_via_iterators(__pyx_self, __pyx_v_Y, __pyx_v_axis); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/bindings/wrapper.pyx":148 + * + * + * def copy_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = copy_via_iterators(Y, int axis=0) + */ - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":159 +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_14copy_via_iterators(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, int __pyx_v_axis) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_Z = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("copy_via_iterators", 0); + + /* "nipy/labs/bindings/wrapper.pyx":159 * * # Allocate output array * Z = np.zeros_like(Y, dtype=np.float) # <<<<<<<<<<<<<< @@ -1786,16 +2302,15 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_Z); __pyx_v_Z = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":162 + /* "nipy/labs/bindings/wrapper.pyx":162 * * # Create a new array iterator * multi = fffpy_multi_iterator_new(2, axis, Y, Z) # <<<<<<<<<<<<<< @@ -1804,7 +2319,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb */ __pyx_v_multi = fffpy_multi_iterator_new(2, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_Z)); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":165 + /* "nipy/labs/bindings/wrapper.pyx":165 * * # Create views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1813,7 +2328,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":166 + /* "nipy/labs/bindings/wrapper.pyx":166 * # Create views * y = multi.vector[0] * z = multi.vector[1] # <<<<<<<<<<<<<< @@ -1822,7 +2337,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb */ __pyx_v_z = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":169 + /* "nipy/labs/bindings/wrapper.pyx":169 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1833,7 +2348,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb __pyx_t_6 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_6) break; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":170 + /* "nipy/labs/bindings/wrapper.pyx":170 * # Loop * while(multi.index < multi.size): * fff_vector_memcpy(z, y) # <<<<<<<<<<<<<< @@ -1842,7 +2357,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb */ fff_vector_memcpy(__pyx_v_z, __pyx_v_y); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":171 + /* "nipy/labs/bindings/wrapper.pyx":171 * while(multi.index < multi.size): * fff_vector_memcpy(z, y) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1852,7 +2367,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":174 + /* "nipy/labs/bindings/wrapper.pyx":174 * * # Free memory * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1861,7 +2376,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":177 + /* "nipy/labs/bindings/wrapper.pyx":177 * * # Return * return Z # <<<<<<<<<<<<<< @@ -1881,68 +2396,58 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators(PyOb __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_via_iterators"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.copy_via_iterators", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_Z); - __Pyx_DECREF((PyObject *)__pyx_v_Y); + __Pyx_XDECREF(__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":180 - * - * - * def sum_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< - * """ - * Z = dummy_iterator(Y, int axis=0) - */ - -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_sum_via_iterators[] = "\n Z = dummy_iterator(Y, int axis=0) \n\n Return the sum of input elements along the dimension specified by axis.\n Behavior should be equivalent to Z = Y.sum(axis). \n "; -static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_17sum_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_8bindings_7wrapper_16sum_via_iterators[] = "\n Z = dummy_iterator(Y, int axis=0) \n\n Return the sum of input elements along the dimension specified by axis.\n Behavior should be equivalent to Z = Y.sum(axis). \n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_8bindings_7wrapper_17sum_via_iterators = {__Pyx_NAMESTR("sum_via_iterators"), (PyCFunction)__pyx_pw_4nipy_4labs_8bindings_7wrapper_17sum_via_iterators, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_16sum_via_iterators)}; +static PyObject *__pyx_pw_4nipy_4labs_8bindings_7wrapper_17sum_via_iterators(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; int __pyx_v_axis; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_z; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_Z; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("sum_via_iterators"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("sum_via_iterators (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__axis,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[1] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "sum_via_iterators") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sum_via_iterators") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_Y = ((PyArrayObject *)values[0]); if (values[1]) { @@ -1950,119 +2455,110 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj } else { __pyx_v_axis = ((int)0); } - } else { - __pyx_v_axis = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 1: __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("sum_via_iterators", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.sum_via_iterators"); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.sum_via_iterators", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_8bindings_7wrapper_16sum_via_iterators(__pyx_self, __pyx_v_Y, __pyx_v_axis); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":191 +/* "nipy/labs/bindings/wrapper.pyx":180 * - * # Allocate output array - * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< - * dims[axis] = 1 - * Z = np.zeros(dims) + * + * def sum_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = dummy_iterator(Y, int axis=0) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_v_i); + +static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_16sum_via_iterators(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, int __pyx_v_axis) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_z; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_Z = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("sum_via_iterators", 0); + + /* "nipy/labs/bindings/wrapper.pyx":191 + * + * # Allocate output array + * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< + * dims[axis] = 1 + * Z = np.zeros(dims) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_Y->nd; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_5])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); + __pyx_t_4 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":192 + /* "nipy/labs/bindings/wrapper.pyx":192 * # Allocate output array * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 # <<<<<<<<<<<<<< * Z = np.zeros(dims) * */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":193 + /* "nipy/labs/bindings/wrapper.pyx":193 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 * Z = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create a new array iterator */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_Z = __pyx_t_5; + __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":196 + /* "nipy/labs/bindings/wrapper.pyx":196 * * # Create a new array iterator * multi = fffpy_multi_iterator_new(2, axis, Y, Z) # <<<<<<<<<<<<<< @@ -2071,7 +2567,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj */ __pyx_v_multi = fffpy_multi_iterator_new(2, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_Z)); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":199 + /* "nipy/labs/bindings/wrapper.pyx":199 * * # Create views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -2080,7 +2576,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":200 + /* "nipy/labs/bindings/wrapper.pyx":200 * # Create views * y = multi.vector[0] * z = multi.vector[1] # <<<<<<<<<<<<<< @@ -2089,7 +2585,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj */ __pyx_v_z = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":203 + /* "nipy/labs/bindings/wrapper.pyx":203 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -2097,10 +2593,10 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj * fffpy_multi_iterator_update(multi) */ while (1) { - __pyx_t_7 = (__pyx_v_multi->index < __pyx_v_multi->size); - if (!__pyx_t_7) break; + __pyx_t_6 = (__pyx_v_multi->index < __pyx_v_multi->size); + if (!__pyx_t_6) break; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":204 + /* "nipy/labs/bindings/wrapper.pyx":204 * # Loop * while(multi.index < multi.size): * z.data[0] = fff_vector_sum(y) # <<<<<<<<<<<<<< @@ -2109,7 +2605,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj */ (__pyx_v_z->data[0]) = ((double)fff_vector_sum(__pyx_v_y)); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":205 + /* "nipy/labs/bindings/wrapper.pyx":205 * while(multi.index < multi.size): * z.data[0] = fff_vector_sum(y) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -2119,7 +2615,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":208 + /* "nipy/labs/bindings/wrapper.pyx":208 * * # Free memory * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -2128,7 +2624,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":211 + /* "nipy/labs/bindings/wrapper.pyx":211 * * # Return * return Z.squeeze() # <<<<<<<<<<<<<< @@ -2136,34 +2632,43 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_Z, __pyx_n_s__squeeze); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_v_Z, __pyx_n_s__squeeze); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.bindings.wrapper.sum_via_iterators"); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("nipy.labs.bindings.wrapper.sum_via_iterators", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_Z); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -2171,8 +2676,7 @@ static PyObject *__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators(PyObj * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -2184,23 +2688,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -2208,7 +2731,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2217,16 +2740,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2236,7 +2759,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2244,11 +2767,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2257,9 +2780,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2269,43 +2792,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2315,142 +2832,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2459,25 +2969,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2486,17 +2996,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2505,7 +3017,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2521,7 +3033,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2533,49 +3045,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2586,50 +3099,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2638,10 +3145,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2651,10 +3158,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2664,10 +3171,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2677,10 +3184,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2690,10 +3197,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2703,10 +3210,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2716,10 +3223,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2729,10 +3236,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2742,10 +3249,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2755,10 +3262,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2768,10 +3275,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2781,10 +3288,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2794,10 +3301,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2807,10 +3314,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2820,10 +3327,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2833,10 +3340,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2846,37 +3353,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2885,7 +3392,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2894,105 +3401,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3000,11 +3516,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3014,7 +3530,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3022,15 +3538,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3040,10 +3555,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3051,7 +3570,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3061,7 +3580,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3069,7 +3588,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3079,10 +3598,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3090,7 +3613,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3100,7 +3623,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3108,7 +3631,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3118,10 +3641,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3129,7 +3656,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3139,7 +3666,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3147,7 +3674,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3157,10 +3684,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3168,7 +3699,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3178,7 +3709,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3186,7 +3717,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3196,10 +3727,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3207,7 +3742,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3217,7 +3752,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3225,7 +3760,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -3234,33 +3769,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3269,7 +3804,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3278,167 +3813,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3446,16 +4008,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3464,469 +4025,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3939,24 +4479,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3966,12 +4505,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3981,7 +4519,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3993,7 +4531,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4002,7 +4540,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4013,7 +4551,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4022,7 +4560,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4031,12 +4569,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4046,11 +4582,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4060,7 +4596,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4075,7 +4611,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4089,32 +4625,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("fff_type"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_fff_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_fff_type)}, - {__Pyx_NAMESTR("npy_type"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_npy_type, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_npy_type)}, - {__Pyx_NAMESTR("pass_vector"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_vector)}, - {__Pyx_NAMESTR("copy_vector"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_vector, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_copy_vector)}, - {__Pyx_NAMESTR("pass_matrix"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_matrix, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_matrix)}, - {__Pyx_NAMESTR("pass_array"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_array, METH_O, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_array)}, - {__Pyx_NAMESTR("pass_vector_via_iterator"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterator, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_pass_vector_via_iterator)}, - {__Pyx_NAMESTR("copy_via_iterators"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_copy_via_iterators, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_copy_via_iterators)}, - {__Pyx_NAMESTR("sum_via_iterators"), (PyCFunction)__pyx_pf_4nipy_4labs_8bindings_7wrapper_sum_via_iterators, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_8bindings_7wrapper_sum_via_iterators)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("wrapper"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -4126,112 +4650,463 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, - {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, - {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_kp_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 0}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, + {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_n_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 1}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s__Xdum, __pyx_k__Xdum, sizeof(__pyx_k__Xdum), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, + {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__c_types, __pyx_k__c_types, sizeof(__pyx_k__c_types), 0, 0, 1, 1}, {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__copy_vector, __pyx_k__copy_vector, sizeof(__pyx_k__copy_vector), 0, 0, 1, 1}, + {&__pyx_n_s__copy_via_iterators, __pyx_k__copy_via_iterators, sizeof(__pyx_k__copy_via_iterators), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__datatype, __pyx_k__datatype, sizeof(__pyx_k__datatype), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__dimT, __pyx_k__dimT, sizeof(__pyx_k__dimT), 0, 0, 1, 1}, - {&__pyx_n_s__dimX, __pyx_k__dimX, sizeof(__pyx_k__dimX), 0, 0, 1, 1}, - {&__pyx_n_s__dimY, __pyx_k__dimY, sizeof(__pyx_k__dimY), 0, 0, 1, 1}, - {&__pyx_n_s__dimZ, __pyx_k__dimZ, sizeof(__pyx_k__dimZ), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__elsize, __pyx_k__elsize, sizeof(__pyx_k__elsize), 0, 0, 1, 1}, + {&__pyx_n_s__fff_t, __pyx_k__fff_t, sizeof(__pyx_k__fff_t), 0, 0, 1, 1}, + {&__pyx_n_s__fff_type, __pyx_k__fff_type, sizeof(__pyx_k__fff_type), 0, 0, 1, 1}, {&__pyx_n_s__fff_types, __pyx_k__fff_types, sizeof(__pyx_k__fff_types), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, {&__pyx_n_s__flag, __pyx_k__flag, sizeof(__pyx_k__flag), 0, 0, 1, 1}, {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, {&__pyx_n_s__long, __pyx_k__long, sizeof(__pyx_k__long), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, + {&__pyx_n_s__nbytes, __pyx_k__nbytes, sizeof(__pyx_k__nbytes), 0, 0, 1, 1}, {&__pyx_n_s__niters, __pyx_k__niters, sizeof(__pyx_k__niters), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__npy_t, __pyx_k__npy_t, sizeof(__pyx_k__npy_t), 0, 0, 1, 1}, + {&__pyx_n_s__npy_type, __pyx_k__npy_type, sizeof(__pyx_k__npy_type), 0, 0, 1, 1}, {&__pyx_n_s__npy_types, __pyx_k__npy_types, sizeof(__pyx_k__npy_types), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__pass_array, __pyx_k__pass_array, sizeof(__pyx_k__pass_array), 0, 0, 1, 1}, + {&__pyx_n_s__pass_matrix, __pyx_k__pass_matrix, sizeof(__pyx_k__pass_matrix), 0, 0, 1, 1}, + {&__pyx_n_s__pass_vector, __pyx_k__pass_vector, sizeof(__pyx_k__pass_vector), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__relstride, __pyx_k__relstride, sizeof(__pyx_k__relstride), 0, 0, 1, 1}, {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__size1, __pyx_k__size1, sizeof(__pyx_k__size1), 0, 0, 1, 1}, - {&__pyx_n_s__size2, __pyx_k__size2, sizeof(__pyx_k__size2), 0, 0, 1, 1}, {&__pyx_n_s__squeeze, __pyx_k__squeeze, sizeof(__pyx_k__squeeze), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__vector, __pyx_k__vector, sizeof(__pyx_k__vector), 0, 0, 1, 1}, + {&__pyx_n_s__stride, __pyx_k__stride, sizeof(__pyx_k__stride), 0, 0, 1, 1}, + {&__pyx_n_s__sum_via_iterators, __pyx_k__sum_via_iterators, sizeof(__pyx_k__sum_via_iterators), 0, 0, 1, 1}, + {&__pyx_n_s__type, __pyx_k__type, sizeof(__pyx_k__type), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } -static int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - return 0; - __pyx_L1_error:; - return -1; -} +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); -#if PY_MAJOR_VERSION < 3 -PyMODINIT_FUNC initwrapper(void); /*proto*/ -PyMODINIT_FUNC initwrapper(void) -#else -PyMODINIT_FUNC PyInit_wrapper(void); /*proto*/ -PyMODINIT_FUNC PyInit_wrapper(void) -#endif -{ - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - PyObject *__pyx_t_9 = NULL; - PyObject *__pyx_t_10 = NULL; - PyObject *__pyx_t_11 = NULL; - PyObject *__pyx_t_12 = NULL; - #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/bindings/wrapper.pyx":34 + * + * + * def fff_type(dtype T): # <<<<<<<<<<<<<< + * """ + * fff_t, nbytes = fff_type(T) + */ + __pyx_k_tuple_22 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_22); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fff_t)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 1, ((PyObject *)__pyx_n_s__fff_t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fff_t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nbytes)); + PyTuple_SET_ITEM(__pyx_k_tuple_22, 2, ((PyObject *)__pyx_n_s__nbytes)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbytes)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + __pyx_k_codeobj_23 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_22, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__fff_type, 34, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":47 + * + * + * def npy_type(T): # <<<<<<<<<<<<<< + * """ + * npy_t, nbytes = npy_type(T) + */ + __pyx_k_tuple_26 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__npy_t)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 1, ((PyObject *)__pyx_n_s__npy_t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__npy_t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fff_t)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 2, ((PyObject *)__pyx_n_s__fff_t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fff_t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nbytes)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 3, ((PyObject *)__pyx_n_s__nbytes)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nbytes)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_codeobj_27 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_26, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__npy_type, 47, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":61 + * return c_types[npy_types.index(npy_t)], nbytes + * + * def pass_vector(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_vector(X) + */ + __pyx_k_tuple_28 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_28, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_k_codeobj_29 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__pass_vector, 61, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":73 + * + * + * def copy_vector(ndarray X, int flag): # <<<<<<<<<<<<<< + * """ + * Y = copy_vector(X, flag) + */ + __pyx_k_tuple_30 = PyTuple_New(10); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 1, ((PyObject *)__pyx_n_s__flag)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__data)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 3, ((PyObject *)__pyx_n_s__data)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__data)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__size)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 4, ((PyObject *)__pyx_n_s__size)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__size)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stride)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 5, ((PyObject *)__pyx_n_s__stride)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stride)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__relstride)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 6, ((PyObject *)__pyx_n_s__relstride)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__relstride)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__type)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 7, ((PyObject *)__pyx_n_s__type)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__type)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__itemsize)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 8, ((PyObject *)__pyx_n_s__itemsize)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__itemsize)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__fff_type)); + PyTuple_SET_ITEM(__pyx_k_tuple_30, 9, ((PyObject *)__pyx_n_s__fff_type)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fff_type)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + __pyx_k_codeobj_31 = (PyObject*)__Pyx_PyCode_New(2, 0, 10, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__copy_vector, 73, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":104 + * + * + * def pass_matrix(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_matrix(X) + */ + __pyx_k_tuple_32 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_32); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_32, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_k_codeobj_33 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__pass_matrix, 104, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":116 + * + * + * def pass_array(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_array(X) + */ + __pyx_k_tuple_34 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(1, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__pass_array, 116, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":128 + * + * + * def pass_vector_via_iterator(ndarray X, int axis=0, int niters=0): # <<<<<<<<<<<<<< + * """ + * Y = pass_vector_via_iterator(X, axis=0, niters=0) + */ + __pyx_k_tuple_36 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_36); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 1, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niters)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 2, ((PyObject *)__pyx_n_s__niters)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niters)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 3, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 4, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 5, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 6, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Xdum)); + PyTuple_SET_ITEM(__pyx_k_tuple_36, 7, ((PyObject *)__pyx_n_s__Xdum)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Xdum)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36)); + __pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s_38, 128, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":148 + * + * + * def copy_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = copy_via_iterators(Y, int axis=0) + */ + __pyx_k_tuple_39 = PyTuple_New(6); if (unlikely(!__pyx_k_tuple_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_39); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 1, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 3, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 4, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_39, 5, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_39)); + __pyx_k_codeobj_40 = (PyObject*)__Pyx_PyCode_New(2, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_39, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__copy_via_iterators, 148, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_40)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/bindings/wrapper.pyx":180 + * + * + * def sum_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = dummy_iterator(Y, int axis=0) + */ + __pyx_k_tuple_41 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_41); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 1, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 2, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 3, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 4, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 5, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 6, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_41, 7, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_41)); + __pyx_k_codeobj_42 = (PyObject*)__Pyx_PyCode_New(2, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_41, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_24, __pyx_n_s__sum_via_iterators, 180, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC initwrapper(void); /*proto*/ +PyMODINIT_FUNC initwrapper(void) +#else +PyMODINIT_FUNC PyInit_wrapper(void); /*proto*/ +PyMODINIT_FUNC PyInit_wrapper(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -4239,14 +5114,19 @@ PyMODINIT_FUNC PyInit_wrapper(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_wrapper(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_wrapper(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -4257,16 +5137,23 @@ PyMODINIT_FUNC PyInit_wrapper(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("wrapper"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("wrapper"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.bindings.wrapper")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.bindings.wrapper", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4275,28 +5162,39 @@ PyMODINIT_FUNC PyInit_wrapper(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":9 + /* "nipy/labs/bindings/wrapper.pyx":9 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":18 + /* "nipy/labs/bindings/wrapper.pyx":18 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -4305,7 +5203,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":19 + /* "nipy/labs/bindings/wrapper.pyx":19 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -4314,19 +5212,19 @@ PyMODINIT_FUNC PyInit_wrapper(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":20 + /* "nipy/labs/bindings/wrapper.pyx":20 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":23 + /* "nipy/labs/bindings/wrapper.pyx":23 * * * c_types = ['unknown type', 'unsigned char', 'signed char', 'unsigned short', 'signed short', # <<<<<<<<<<<<<< @@ -4334,31 +5232,31 @@ PyMODINIT_FUNC PyInit_wrapper(void) * */ __pyx_t_1 = PyList_New(11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_9)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); - PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); - PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_kp_s_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); - PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_kp_s_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); - PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_kp_s_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_13)); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_15)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_16)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_kp_s_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_16)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_17)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_kp_s_17)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_17)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_19)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_kp_s_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_19)); __Pyx_INCREF(((PyObject *)__pyx_n_s__int)); PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__int)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__int)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_14)); - PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_kp_s_14)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_14)); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_15)); - PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_kp_s_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_20)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_kp_s_20)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_20)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_21)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_kp_s_21)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_21)); __Pyx_INCREF(((PyObject *)__pyx_n_s__long)); PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__long)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__long)); @@ -4371,7 +5269,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__c_types, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":26 + /* "nipy/labs/bindings/wrapper.pyx":26 * 'int', 'unsigned int', 'unsigned long', 'long', 'float', 'double'] * * fff_types = [FFF_UNKNOWN_TYPE, FFF_UCHAR, FFF_SCHAR, FFF_USHORT, FFF_SSHORT, # <<<<<<<<<<<<<< @@ -4389,7 +5287,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __pyx_t_5 = PyInt_FromLong(FFF_SSHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":27 + /* "nipy/labs/bindings/wrapper.pyx":27 * * fff_types = [FFF_UNKNOWN_TYPE, FFF_UCHAR, FFF_SCHAR, FFF_USHORT, FFF_SSHORT, * FFF_UINT, FFF_INT, FFF_ULONG, FFF_LONG, FFF_FLOAT, FFF_DOUBLE] # <<<<<<<<<<<<<< @@ -4409,7 +5307,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __pyx_t_11 = PyInt_FromLong(FFF_DOUBLE); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __pyx_t_12 = PyList_New(11); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __Pyx_GOTREF(__pyx_t_12); PyList_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_12, 1, __pyx_t_2); @@ -4446,7 +5344,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fff_types, ((PyObject *)__pyx_t_12)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":29 + /* "nipy/labs/bindings/wrapper.pyx":29 * FFF_UINT, FFF_INT, FFF_ULONG, FFF_LONG, FFF_FLOAT, FFF_DOUBLE] * * npy_types = [cnp.NPY_NOTYPE, cnp.NPY_UBYTE, cnp.NPY_BYTE, cnp.NPY_USHORT, # <<<<<<<<<<<<<< @@ -4462,7 +5360,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __pyx_t_9 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":30 + /* "nipy/labs/bindings/wrapper.pyx":30 * * npy_types = [cnp.NPY_NOTYPE, cnp.NPY_UBYTE, cnp.NPY_BYTE, cnp.NPY_USHORT, * cnp.NPY_SHORT, cnp.NPY_UINT, cnp.NPY_INT, cnp.NPY_ULONG, # <<<<<<<<<<<<<< @@ -4478,7 +5376,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "/home/alexis/git/nipy/nipy/labs/bindings/wrapper.pyx":31 + /* "nipy/labs/bindings/wrapper.pyx":31 * npy_types = [cnp.NPY_NOTYPE, cnp.NPY_UBYTE, cnp.NPY_BYTE, cnp.NPY_USHORT, * cnp.NPY_SHORT, cnp.NPY_UINT, cnp.NPY_INT, cnp.NPY_ULONG, * cnp.NPY_LONG, cnp.NPY_FLOAT, cnp.NPY_DOUBLE] # <<<<<<<<<<<<<< @@ -4492,7 +5390,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __pyx_t_2 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyList_New(11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_t_1); PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); PyList_SET_ITEM(__pyx_t_1, 1, __pyx_t_11); @@ -4529,10 +5427,130 @@ PyMODINIT_FUNC PyInit_wrapper(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__npy_types, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/bindings/wrapper.pyx":34 + * + * + * def fff_type(dtype T): # <<<<<<<<<<<<<< + * """ + * fff_t, nbytes = fff_type(T) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_1fff_type, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__fff_type, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":47 + * + * + * def npy_type(T): # <<<<<<<<<<<<<< + * """ + * npy_t, nbytes = npy_type(T) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_3npy_type, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__npy_type, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":61 + * return c_types[npy_types.index(npy_t)], nbytes + * + * def pass_vector(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_vector(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_5pass_vector, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pass_vector, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":73 + * + * + * def copy_vector(ndarray X, int flag): # <<<<<<<<<<<<<< + * """ + * Y = copy_vector(X, flag) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_7copy_vector, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_vector, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":104 + * + * + * def pass_matrix(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_matrix(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_9pass_matrix, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pass_matrix, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":116 + * + * + * def pass_array(ndarray X): # <<<<<<<<<<<<<< + * """ + * Y = pass_array(X) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_11pass_array, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pass_array, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":128 + * + * + * def pass_vector_via_iterator(ndarray X, int axis=0, int niters=0): # <<<<<<<<<<<<<< + * """ + * Y = pass_vector_via_iterator(X, axis=0, niters=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_13pass_vector_via_iterator, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_38, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":148 + * + * + * def copy_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = copy_via_iterators(Y, int axis=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_15copy_via_iterators, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__copy_via_iterators, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":180 + * + * + * def sum_via_iterators(ndarray Y, int axis=0): # <<<<<<<<<<<<<< + * """ + * Z = dummy_iterator(Y, int axis=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_8bindings_7wrapper_17sum_via_iterators, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sum_via_iterators, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/bindings/wrapper.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; @@ -4549,7 +5567,7 @@ PyMODINIT_FUNC PyInit_wrapper(void) __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.bindings.wrapper"); + __Pyx_AddTraceback("init nipy.labs.bindings.wrapper", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.bindings.wrapper"); @@ -4563,28 +5581,56 @@ PyMODINIT_FUNC PyInit_wrapper(void) #endif } -static const char *__pyx_filenames[] = { - "wrapper.pyx", - "numpy.pxd", -}; - /* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) { + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; } static void __Pyx_RaiseArgtupleInvalid( @@ -4595,8 +5641,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4607,14 +5652,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -4629,55 +5683,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4703,42 +5779,245 @@ static CYTHON_INLINE int __Pyx_div_int(int a, int b) { return q; } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; } } - return item; + return 0; +#endif } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); return -1; + } else { + return __Pyx_IterFinish(); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -4753,49 +6032,15 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(); - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -4811,38 +6056,73 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); } } @@ -4910,15 +6190,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4985,152 +6310,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -5304,6 +6537,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -5325,9 +6577,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -5360,9 +6612,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -5395,9 +6647,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -5430,9 +6682,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -5465,9 +6717,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -5500,9 +6752,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -5514,24 +6766,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5542,19 +6825,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -5563,54 +6850,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5621,28 +6963,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5650,11 +7009,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5689,11 +7046,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/glm/kalman.c b/nipy/labs/glm/kalman.c index 83962bf373..64cadf2454 100644 --- a/nipy/labs/glm/kalman.c +++ b/nipy/labs/glm/kalman.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:43:19 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:35 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__glm__kalman #define __PYX_HAVE_API__nipy__labs__glm__kalman -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -163,120 +261,79 @@ #include "fff_array.h" #include "fffpy.h" #include "fff_glm_kalman.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -287,8 +344,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -299,7 +354,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -307,52 +361,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "kalman.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -373,20 +590,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -397,50 +641,80 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -448,43 +722,60 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -498,7 +789,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -519,11 +809,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -534,7 +830,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -549,11 +848,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -564,14 +869,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -590,6 +893,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -602,57 +907,90 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.glm.kalman */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.glm.kalman' */ #define __Pyx_MODULE_NAME "nipy.labs.glm.kalman" int __pyx_module_is_main_nipy__labs__glm__kalman = 0; -/* Implementation of nipy.labs.glm.kalman */ +/* Implementation of 'nipy.labs.glm.kalman' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_X, int __pyx_v_axis); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_2ar1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_X, int __pyx_v_niter, int __pyx_v_axis); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nIncremental (Kalman-like) filters for linear regression. \n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nIncremental (Kalman-like) filters for linear regression. \n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/glm/kalman.pyx"; +static char __pyx_k_18[] = "nipy.labs.glm.kalman"; +static char __pyx_k__A[] = "A"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -669,167 +1007,150 @@ static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; +static char __pyx_k__p[] = "p"; static char __pyx_k__q[] = "q"; -static char __pyx_k__Vb[] = "Vb"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__S2[] = "S2"; +static char __pyx_k__VB[] = "VB"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; +static char __pyx_k__p2[] = "p2"; static char __pyx_k__s2[] = "s2"; -static char __pyx_k__buf[] = "buf"; +static char __pyx_k__vb[] = "vb"; +static char __pyx_k__ar1[] = "ar1"; static char __pyx_k__dof[] = "dof"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__ols[] = "ols"; static char __pyx_k__axis[] = "axis"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dims[] = "dims"; static char __pyx_k__dtype[] = "dtype"; -static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__kfilt[] = "kfilt"; +static char __pyx_k__multi[] = "multi"; static char __pyx_k__niter[] = "niter"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__size2[] = "size2"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__double[] = "double"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__insert[] = "insert"; -static char __pyx_k__vector[] = "vector"; +static char __pyx_k__rkfilt[] = "rkfilt"; +static char __pyx_k__Vb_flat[] = "Vb_flat"; static char __pyx_k__reshape[] = "reshape"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__A; +static PyObject *__pyx_n_s__B; static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__S2; +static PyObject *__pyx_n_s__VB; static PyObject *__pyx_n_s__ValueError; -static PyObject *__pyx_n_s__Vb; +static PyObject *__pyx_n_s__Vb_flat; static PyObject *__pyx_n_s__X; static PyObject *__pyx_n_s__Y; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__a; +static PyObject *__pyx_n_s__ar1; static PyObject *__pyx_n_s__axis; static PyObject *__pyx_n_s__b; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__dof; static PyObject *__pyx_n_s__double; static PyObject *__pyx_n_s__dtype; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__index; -static PyObject *__pyx_n_s__insert; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__kfilt; +static PyObject *__pyx_n_s__multi; static PyObject *__pyx_n_s__niter; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__ols; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__p2; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__rkfilt; static PyObject *__pyx_n_s__s2; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__size2; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__vector; +static PyObject *__pyx_n_s__vb; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":68 - * # Standard Kalman filter - * - * def ols(ndarray Y, ndarray X, int axis=0): # <<<<<<<<<<<<<< - * """ - * (beta, norm_var_beta, s2, dof) = ols(Y, X, axis=0). - */ - -static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_20; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_3glm_6kalman_1ols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_4labs_3glm_6kalman_ols[] = "\n (beta, norm_var_beta, s2, dof) = ols(Y, X, axis=0).\n\n Ordinary least-square multiple regression using the Kalman filter.\n Fit the N-dimensional array Y along the given axis in terms of the\n regressors in matrix X. The regressors must be stored columnwise.\n\n OUTPUT: a four-element tuple\n beta -- array of parameter estimates\n norm_var_beta -- normalized variance matrix of the parameter\n estimates (data independent)\n s2 -- array of squared scale\n parameters to multiply norm_var_beta for the variance matrix of\n beta.\n dof -- scalar degrees of freedom.\n\n REFERENCE: Roche et al, ISBI 2004.\n "; -static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_4labs_3glm_6kalman_1ols = {__Pyx_NAMESTR("ols"), (PyCFunction)__pyx_pw_4nipy_4labs_3glm_6kalman_1ols, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_3glm_6kalman_ols)}; +static PyObject *__pyx_pw_4nipy_4labs_3glm_6kalman_1ols(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_X = 0; int __pyx_v_axis; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_b; - fff_vector *__pyx_v_s2; - fff_matrix *__pyx_v_x; - fff_glm_KF *__pyx_v_kfilt; - size_t __pyx_v_p; - fffpy_multi_iterator *__pyx_v_multi; - double __pyx_v_dof; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_B; - PyObject *__pyx_v_S2; - PyObject *__pyx_v_VB; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__X,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("ols"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ols (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__X,&__pyx_n_s__axis,0}; PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("ols", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("ols", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ols") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ols") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_X = ((PyArrayObject *)values[1]); @@ -838,36 +1159,66 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO } else { __pyx_v_axis = ((int)0); } - } else { - __pyx_v_axis = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("ols", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.glm.kalman.ols"); + __Pyx_AddTraceback("nipy.labs.glm.kalman.ols", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_X); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_S2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_VB = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_3glm_6kalman_ols(__pyx_self, __pyx_v_Y, __pyx_v_X, __pyx_v_axis); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/glm/kalman.pyx":68 + * # Standard Kalman filter + * + * def ols(ndarray Y, ndarray X, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof) = ols(Y, X, axis=0). + */ + +static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_X, int __pyx_v_axis) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_b; + fff_vector *__pyx_v_s2; + fff_matrix *__pyx_v_x; + fff_glm_KF *__pyx_v_kfilt; + size_t __pyx_v_p; + fffpy_multi_iterator *__pyx_v_multi; + double __pyx_v_dof; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_B = NULL; + PyObject *__pyx_v_S2 = NULL; + PyArrayObject *__pyx_v_VB = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + double __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ols", 0); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":95 + /* "nipy/labs/glm/kalman.pyx":95 * * # View on design matrix * x = fff_matrix_fromPyArray(X) # <<<<<<<<<<<<<< @@ -876,128 +1227,95 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_x = fff_matrix_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":98 + /* "nipy/labs/glm/kalman.pyx":98 * * # Number of regressors * p = x.size2 # <<<<<<<<<<<<<< * * # Allocate output arrays B and S2 */ - __pyx_v_p = __pyx_v_x->size2; + __pyx_t_1 = __pyx_v_x->size2; + __pyx_v_p = __pyx_t_1; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":105 + /* "nipy/labs/glm/kalman.pyx":105 * # type; see: * # http://codespeak.net/pipermail/cython-dev/2009-April/005229.html * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< * dims[axis] = p * B = np.zeros(dims, dtype=np.double) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_5])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_v_Y->nd; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_5 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":106 + /* "nipy/labs/glm/kalman.pyx":106 * # http://codespeak.net/pipermail/cython-dev/2009-April/005229.html * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p # <<<<<<<<<<<<<< * B = np.zeros(dims, dtype=np.double) * dims[axis] = 1 */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_5, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":107 + /* "nipy/labs/glm/kalman.pyx":107 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p * B = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< * dims[axis] = 1 * S2 = np.zeros(dims, dtype=np.double) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_B); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_B = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":108 + /* "nipy/labs/glm/kalman.pyx":108 * dims[axis] = p * B = np.zeros(dims, dtype=np.double) * dims[axis] = 1 # <<<<<<<<<<<<<< * S2 = np.zeros(dims, dtype=np.double) * */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":109 + /* "nipy/labs/glm/kalman.pyx":109 * B = np.zeros(dims, dtype=np.double) * dims[axis] = 1 * S2 = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< @@ -1006,33 +1324,32 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_8, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_S2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_S2 = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":112 + /* "nipy/labs/glm/kalman.pyx":112 * * # Allocate local structure * kfilt = fff_glm_KF_new(p) # <<<<<<<<<<<<<< @@ -1041,7 +1358,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_kfilt = fff_glm_KF_new(__pyx_v_p); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":115 + /* "nipy/labs/glm/kalman.pyx":115 * * # Create a new array iterator * multi = fffpy_multi_iterator_new(3, axis, Y, B, S2) # <<<<<<<<<<<<<< @@ -1050,7 +1367,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_multi = fffpy_multi_iterator_new(3, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_B), ((void *)__pyx_v_S2)); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":118 + /* "nipy/labs/glm/kalman.pyx":118 * * # Create views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1059,7 +1376,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":119 + /* "nipy/labs/glm/kalman.pyx":119 * # Create views * y = multi.vector[0] * b = multi.vector[1] # <<<<<<<<<<<<<< @@ -1068,7 +1385,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_b = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":120 + /* "nipy/labs/glm/kalman.pyx":120 * y = multi.vector[0] * b = multi.vector[1] * s2 = multi.vector[2] # <<<<<<<<<<<<<< @@ -1077,7 +1394,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_v_s2 = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":123 + /* "nipy/labs/glm/kalman.pyx":123 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1088,7 +1405,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO __pyx_t_9 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_9) break; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":124 + /* "nipy/labs/glm/kalman.pyx":124 * # Loop * while(multi.index < multi.size): * fff_glm_KF_fit(kfilt, y, x) # <<<<<<<<<<<<<< @@ -1097,7 +1414,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ fff_glm_KF_fit(__pyx_v_kfilt, __pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":125 + /* "nipy/labs/glm/kalman.pyx":125 * while(multi.index < multi.size): * fff_glm_KF_fit(kfilt, y, x) * fff_vector_memcpy(b, kfilt.b) # <<<<<<<<<<<<<< @@ -1106,16 +1423,17 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ fff_vector_memcpy(__pyx_v_b, __pyx_v_kfilt->b); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":126 + /* "nipy/labs/glm/kalman.pyx":126 * fff_glm_KF_fit(kfilt, y, x) * fff_vector_memcpy(b, kfilt.b) * s2.data[0] = kfilt.s2 # <<<<<<<<<<<<<< * fffpy_multi_iterator_update(multi) * */ - (__pyx_v_s2->data[0]) = __pyx_v_kfilt->s2; + __pyx_t_10 = __pyx_v_kfilt->s2; + (__pyx_v_s2->data[0]) = __pyx_t_10; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":127 + /* "nipy/labs/glm/kalman.pyx":127 * fff_vector_memcpy(b, kfilt.b) * s2.data[0] = kfilt.s2 * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1125,7 +1443,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":130 + /* "nipy/labs/glm/kalman.pyx":130 * * # Normalized variance (computed from the last item) * VB = fff_matrix_const_toPyArray(kfilt.Vb); # <<<<<<<<<<<<<< @@ -1134,20 +1452,20 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ __pyx_t_7 = ((PyObject *)fff_matrix_const_toPyArray(__pyx_v_kfilt->Vb)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_v_VB); - __pyx_v_VB = __pyx_t_7; + __pyx_v_VB = ((PyArrayObject *)__pyx_t_7); __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":131 + /* "nipy/labs/glm/kalman.pyx":131 * # Normalized variance (computed from the last item) * VB = fff_matrix_const_toPyArray(kfilt.Vb); * dof = kfilt.dof # <<<<<<<<<<<<<< * * # Free memory */ - __pyx_v_dof = __pyx_v_kfilt->dof; + __pyx_t_10 = __pyx_v_kfilt->dof; + __pyx_v_dof = __pyx_t_10; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":134 + /* "nipy/labs/glm/kalman.pyx":134 * * # Free memory * fff_matrix_delete(x) # <<<<<<<<<<<<<< @@ -1156,7 +1474,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ fff_matrix_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":135 + /* "nipy/labs/glm/kalman.pyx":135 * # Free memory * fff_matrix_delete(x) * fff_glm_KF_delete(kfilt) # <<<<<<<<<<<<<< @@ -1165,7 +1483,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ fff_glm_KF_delete(__pyx_v_kfilt); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":136 + /* "nipy/labs/glm/kalman.pyx":136 * fff_matrix_delete(x) * fff_glm_KF_delete(kfilt) * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1174,7 +1492,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":139 + /* "nipy/labs/glm/kalman.pyx":139 * * # Return * return B, VB, S2, dof # <<<<<<<<<<<<<< @@ -1184,129 +1502,104 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ols(PyObject *__pyx_self, PyO __Pyx_XDECREF(__pyx_r); __pyx_t_7 = PyFloat_FromDouble(__pyx_v_dof); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_B); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_B); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_B); __Pyx_GIVEREF(__pyx_v_B); - __Pyx_INCREF(__pyx_v_VB); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_VB); - __Pyx_GIVEREF(__pyx_v_VB); + __Pyx_INCREF(((PyObject *)__pyx_v_VB)); + PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_VB)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_VB)); __Pyx_INCREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_S2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_S2); __Pyx_GIVEREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("nipy.labs.glm.kalman.ols"); + __Pyx_AddTraceback("nipy.labs.glm.kalman.ols", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_B); - __Pyx_DECREF(__pyx_v_S2); - __Pyx_DECREF(__pyx_v_VB); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_B); + __Pyx_XDECREF(__pyx_v_S2); + __Pyx_XDECREF((PyObject *)__pyx_v_VB); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":142 - * - * - * def ar1(ndarray Y, ndarray X, int niter=2, int axis=0): # <<<<<<<<<<<<<< - * """ - * (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0) - */ - -static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_3glm_6kalman_ar1[] = "\n (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0)\n\n Refined Kalman filter -- enhanced Kalman filter to account for\n noise autocorrelation using an AR(1) model. Pseudo-likelihood\n multiple regression using the refined Kalman filter, a Kalman\n variant based on a AR(1) error model. Fit the N-dimensional array\n Y along the given axis in terms of the regressors in matrix X. The\n regressors must be stored columnwise.\n\n OUTPUT: a five-element tuple\n beta -- array of parameter estimates\n norm_var_beta -- array of normalized variance matrices (which are data dependent\n unlike in standard OLS regression)\n s2 -- array of squared scale parameters to multiply norm_var_beta for the variance matrix of beta.\n dof -- scalar degrees of freedom\n a -- array of error autocorrelation estimates\n\n REFERENCE:\n Roche et al, MICCAI 2004.\n "; -static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_3glm_6kalman_3ar1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_3glm_6kalman_2ar1[] = "\n (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0)\n\n Refined Kalman filter -- enhanced Kalman filter to account for\n noise autocorrelation using an AR(1) model. Pseudo-likelihood\n multiple regression using the refined Kalman filter, a Kalman\n variant based on a AR(1) error model. Fit the N-dimensional array\n Y along the given axis in terms of the regressors in matrix X. The\n regressors must be stored columnwise.\n\n OUTPUT: a five-element tuple\n beta -- array of parameter estimates\n norm_var_beta -- array of normalized variance matrices (which are data dependent\n unlike in standard OLS regression)\n s2 -- array of squared scale parameters to multiply norm_var_beta for the variance matrix of beta.\n dof -- scalar degrees of freedom\n a -- array of error autocorrelation estimates\n\n REFERENCE:\n Roche et al, MICCAI 2004.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_3glm_6kalman_3ar1 = {__Pyx_NAMESTR("ar1"), (PyCFunction)__pyx_pw_4nipy_4labs_3glm_6kalman_3ar1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_3glm_6kalman_2ar1)}; +static PyObject *__pyx_pw_4nipy_4labs_3glm_6kalman_3ar1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_X = 0; int __pyx_v_niter; int __pyx_v_axis; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_b; - fff_vector *__pyx_v_vb; - fff_vector *__pyx_v_s2; - fff_vector *__pyx_v_a; - fff_vector __pyx_v_Vb_flat; - fff_matrix *__pyx_v_x; - fff_glm_RKF *__pyx_v_rkfilt; - size_t __pyx_v_p; - size_t __pyx_v_p2; - fffpy_multi_iterator *__pyx_v_multi; - double __pyx_v_dof; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_B; - PyObject *__pyx_v_VB; - PyObject *__pyx_v_S2; - PyObject *__pyx_v_A; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; - int __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__X,&__pyx_n_s__niter,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("ar1"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ar1 (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__X,&__pyx_n_s__niter,&__pyx_n_s__axis,0}; PyObject* values[4] = {0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("ar1", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("ar1", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[3] = value; kw_args--; } + } } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[2] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ar1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[3] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ar1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_X = ((PyArrayObject *)values[1]); if (values[2]) { @@ -1319,40 +1612,72 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO } else { __pyx_v_axis = ((int)0); } - } else { - __pyx_v_niter = ((int)2); - __pyx_v_axis = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 4: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_niter = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_niter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("ar1", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.glm.kalman.ar1"); + __Pyx_AddTraceback("nipy.labs.glm.kalman.ar1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_X); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_VB = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_S2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_A = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_3glm_6kalman_2ar1(__pyx_self, __pyx_v_Y, __pyx_v_X, __pyx_v_niter, __pyx_v_axis); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/glm/kalman.pyx":142 + * + * + * def ar1(ndarray Y, ndarray X, int niter=2, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0) + */ + +static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_2ar1(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_X, int __pyx_v_niter, int __pyx_v_axis) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_b; + fff_vector *__pyx_v_vb; + fff_vector *__pyx_v_s2; + fff_vector *__pyx_v_a; + fff_vector __pyx_v_Vb_flat; + fff_matrix *__pyx_v_x; + fff_glm_RKF *__pyx_v_rkfilt; + size_t __pyx_v_p; + size_t __pyx_v_p2; + fffpy_multi_iterator *__pyx_v_multi; + double __pyx_v_dof; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_B = NULL; + PyObject *__pyx_v_VB = NULL; + PyObject *__pyx_v_S2 = NULL; + PyObject *__pyx_v_A = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + double __pyx_t_10; + int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ar1", 0); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":173 + /* "nipy/labs/glm/kalman.pyx":173 * * # View on design matrix * x = fff_matrix_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1361,16 +1686,17 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_x = fff_matrix_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":176 + /* "nipy/labs/glm/kalman.pyx":176 * * # Number of regressors * p = x.size2 # <<<<<<<<<<<<<< * p2 = p*p * */ - __pyx_v_p = __pyx_v_x->size2; + __pyx_t_1 = __pyx_v_x->size2; + __pyx_v_p = __pyx_t_1; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":177 + /* "nipy/labs/glm/kalman.pyx":177 * # Number of regressors * p = x.size2 * p2 = p*p # <<<<<<<<<<<<<< @@ -1379,110 +1705,76 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_p2 = (__pyx_v_p * __pyx_v_p); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":184 + /* "nipy/labs/glm/kalman.pyx":184 * # type; see: * # http://codespeak.net/pipermail/cython-dev/2009-April/005229.html * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< * dims[axis] = p * B = np.zeros(dims, dtype=np.double) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_5])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_v_Y->nd; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_5 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_5); + __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":185 + /* "nipy/labs/glm/kalman.pyx":185 * # http://codespeak.net/pipermail/cython-dev/2009-April/005229.html * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p # <<<<<<<<<<<<<< * B = np.zeros(dims, dtype=np.double) * dims[axis] = p2 */ - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_5, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":186 + /* "nipy/labs/glm/kalman.pyx":186 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p * B = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< * dims[axis] = p2 * VB = np.zeros(dims, dtype=np.double) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_B); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_B = __pyx_t_8; __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":187 + /* "nipy/labs/glm/kalman.pyx":187 * dims[axis] = p * B = np.zeros(dims, dtype=np.double) * dims[axis] = p2 # <<<<<<<<<<<<<< @@ -1491,10 +1783,10 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_p2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_8, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_8, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":188 + /* "nipy/labs/glm/kalman.pyx":188 * B = np.zeros(dims, dtype=np.double) * dims[axis] = p2 * VB = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< @@ -1503,42 +1795,41 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_8, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_8), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_VB); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_VB = __pyx_t_7; __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":189 + /* "nipy/labs/glm/kalman.pyx":189 * dims[axis] = p2 * VB = np.zeros(dims, dtype=np.double) * dims[axis] = 1 # <<<<<<<<<<<<<< * S2 = np.zeros(dims, dtype=np.double) * A = np.zeros(dims, dtype=np.double) */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":190 + /* "nipy/labs/glm/kalman.pyx":190 * VB = np.zeros(dims, dtype=np.double) * dims[axis] = 1 * S2 = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< @@ -1547,68 +1838,66 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__zeros); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__double); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__double); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_S2 = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":191 + /* "nipy/labs/glm/kalman.pyx":191 * dims[axis] = 1 * S2 = np.zeros(dims, dtype=np.double) * A = np.zeros(dims, dtype=np.double) # <<<<<<<<<<<<<< * * # Allocate local structure */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__double); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_8, __pyx_t_4, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_7, ((PyObject *)__pyx_n_s__dtype), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_A); - __pyx_v_A = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_A = __pyx_t_6; + __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":194 + /* "nipy/labs/glm/kalman.pyx":194 * * # Allocate local structure * rkfilt = fff_glm_RKF_new(p) # <<<<<<<<<<<<<< @@ -1617,7 +1906,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_rkfilt = fff_glm_RKF_new(__pyx_v_p); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":197 + /* "nipy/labs/glm/kalman.pyx":197 * * # Create a new array iterator * multi = fffpy_multi_iterator_new(5, axis, Y, B, VB, S2, A) # <<<<<<<<<<<<<< @@ -1626,7 +1915,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_multi = fffpy_multi_iterator_new(5, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_B), ((void *)__pyx_v_VB), ((void *)__pyx_v_S2), ((void *)__pyx_v_A)); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":200 + /* "nipy/labs/glm/kalman.pyx":200 * * # Create views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1635,7 +1924,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":201 + /* "nipy/labs/glm/kalman.pyx":201 * # Create views * y = multi.vector[0] * b = multi.vector[1] # <<<<<<<<<<<<<< @@ -1644,7 +1933,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_b = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":202 + /* "nipy/labs/glm/kalman.pyx":202 * y = multi.vector[0] * b = multi.vector[1] * vb = multi.vector[2] # <<<<<<<<<<<<<< @@ -1653,7 +1942,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_vb = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":203 + /* "nipy/labs/glm/kalman.pyx":203 * b = multi.vector[1] * vb = multi.vector[2] * s2 = multi.vector[3] # <<<<<<<<<<<<<< @@ -1662,7 +1951,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_s2 = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":204 + /* "nipy/labs/glm/kalman.pyx":204 * vb = multi.vector[2] * s2 = multi.vector[3] * a = multi.vector[4] # <<<<<<<<<<<<<< @@ -1671,7 +1960,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_a = (__pyx_v_multi->vector[4]); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":207 + /* "nipy/labs/glm/kalman.pyx":207 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1682,7 +1971,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO __pyx_t_9 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_9) break; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":208 + /* "nipy/labs/glm/kalman.pyx":208 * # Loop * while(multi.index < multi.size): * fff_glm_RKF_fit(rkfilt, niter, y, x) # <<<<<<<<<<<<<< @@ -1691,7 +1980,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fff_glm_RKF_fit(__pyx_v_rkfilt, __pyx_v_niter, __pyx_v_y, __pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":209 + /* "nipy/labs/glm/kalman.pyx":209 * while(multi.index < multi.size): * fff_glm_RKF_fit(rkfilt, niter, y, x) * fff_vector_memcpy(b, rkfilt.b) # <<<<<<<<<<<<<< @@ -1700,7 +1989,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fff_vector_memcpy(__pyx_v_b, __pyx_v_rkfilt->b); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":210 + /* "nipy/labs/glm/kalman.pyx":210 * fff_glm_RKF_fit(rkfilt, niter, y, x) * fff_vector_memcpy(b, rkfilt.b) * Vb_flat = fff_vector_view(rkfilt.Vb.data, p2, 1) # rkfilt.Vb contiguous by construction # <<<<<<<<<<<<<< @@ -1709,7 +1998,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ __pyx_v_Vb_flat = fff_vector_view(__pyx_v_rkfilt->Vb->data, __pyx_v_p2, 1); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":211 + /* "nipy/labs/glm/kalman.pyx":211 * fff_vector_memcpy(b, rkfilt.b) * Vb_flat = fff_vector_view(rkfilt.Vb.data, p2, 1) # rkfilt.Vb contiguous by construction * fff_vector_memcpy(vb, &Vb_flat) # <<<<<<<<<<<<<< @@ -1718,25 +2007,27 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fff_vector_memcpy(__pyx_v_vb, (&__pyx_v_Vb_flat)); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":212 + /* "nipy/labs/glm/kalman.pyx":212 * Vb_flat = fff_vector_view(rkfilt.Vb.data, p2, 1) # rkfilt.Vb contiguous by construction * fff_vector_memcpy(vb, &Vb_flat) * s2.data[0] = rkfilt.s2 # <<<<<<<<<<<<<< * a.data[0] = rkfilt.a * fffpy_multi_iterator_update(multi) */ - (__pyx_v_s2->data[0]) = __pyx_v_rkfilt->s2; + __pyx_t_10 = __pyx_v_rkfilt->s2; + (__pyx_v_s2->data[0]) = __pyx_t_10; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":213 + /* "nipy/labs/glm/kalman.pyx":213 * fff_vector_memcpy(vb, &Vb_flat) * s2.data[0] = rkfilt.s2 * a.data[0] = rkfilt.a # <<<<<<<<<<<<<< * fffpy_multi_iterator_update(multi) * */ - (__pyx_v_a->data[0]) = __pyx_v_rkfilt->a; + __pyx_t_10 = __pyx_v_rkfilt->a; + (__pyx_v_a->data[0]) = __pyx_t_10; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":214 + /* "nipy/labs/glm/kalman.pyx":214 * s2.data[0] = rkfilt.s2 * a.data[0] = rkfilt.a * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1746,16 +2037,17 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":217 + /* "nipy/labs/glm/kalman.pyx":217 * * # Dof * dof = rkfilt.dof # <<<<<<<<<<<<<< * * # Free memory */ - __pyx_v_dof = __pyx_v_rkfilt->dof; + __pyx_t_10 = __pyx_v_rkfilt->dof; + __pyx_v_dof = __pyx_t_10; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":220 + /* "nipy/labs/glm/kalman.pyx":220 * * # Free memory * fff_matrix_delete(x) # <<<<<<<<<<<<<< @@ -1764,7 +2056,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fff_matrix_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":221 + /* "nipy/labs/glm/kalman.pyx":221 * # Free memory * fff_matrix_delete(x) * fff_glm_RKF_delete(rkfilt) # <<<<<<<<<<<<<< @@ -1773,7 +2065,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fff_glm_RKF_delete(__pyx_v_rkfilt); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":222 + /* "nipy/labs/glm/kalman.pyx":222 * fff_matrix_delete(x) * fff_glm_RKF_delete(rkfilt) * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1782,68 +2074,53 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":225 + /* "nipy/labs/glm/kalman.pyx":225 * * # Reshape variance array * dims[axis] = p # <<<<<<<<<<<<<< * dims.insert(axis+1, p) * VB = VB.reshape(dims) */ - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_3, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_6, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":226 + /* "nipy/labs/glm/kalman.pyx":226 * # Reshape variance array * dims[axis] = p * dims.insert(axis+1, p) # <<<<<<<<<<<<<< * VB = VB.reshape(dims) * */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_dims, __pyx_n_s__insert); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PyInt_FromLong((__pyx_v_axis + 1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_7 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_8, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_11 = PyList_Insert(__pyx_v_dims, (__pyx_v_axis + 1), __pyx_t_6); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":227 + /* "nipy/labs/glm/kalman.pyx":227 * dims[axis] = p * dims.insert(axis+1, p) * VB = VB.reshape(dims) # <<<<<<<<<<<<<< * * # Return */ - __pyx_t_4 = PyObject_GetAttr(__pyx_v_VB, __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_v_VB, __pyx_n_s__reshape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_2 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_VB); - __pyx_v_VB = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_VB = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":230 + /* "nipy/labs/glm/kalman.pyx":230 * * # Return * return B, VB, S2, dof, A # <<<<<<<<<<<<<< @@ -1851,54 +2128,62 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_dof); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(5); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_dof); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = PyTuple_New(5); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_B); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_B); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_B); __Pyx_GIVEREF(__pyx_v_B); __Pyx_INCREF(__pyx_v_VB); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_VB); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_VB); __Pyx_GIVEREF(__pyx_v_VB); __Pyx_INCREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_v_S2); + PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_v_S2); __Pyx_GIVEREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_A); - PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_v_A); + PyTuple_SET_ITEM(__pyx_t_7, 4, __pyx_v_A); __Pyx_GIVEREF(__pyx_v_A); - __pyx_t_3 = 0; - __pyx_r = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_7); + __pyx_t_7 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("nipy.labs.glm.kalman.ar1"); + __Pyx_AddTraceback("nipy.labs.glm.kalman.ar1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_B); - __Pyx_DECREF(__pyx_v_VB); - __Pyx_DECREF(__pyx_v_S2); - __Pyx_DECREF(__pyx_v_A); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_B); + __Pyx_XDECREF(__pyx_v_VB); + __Pyx_XDECREF(__pyx_v_S2); + __Pyx_XDECREF(__pyx_v_A); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1906,8 +2191,7 @@ static PyObject *__pyx_pf_4nipy_4labs_3glm_6kalman_ar1(PyObject *__pyx_self, PyO * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -1919,49 +2203,68 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 # <<<<<<<<<<<<<< - * cdef bint little_endian = ((&endian_detector)[0] != 0) * - */ - __pyx_v_endian_detector = 1; - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 - * cdef int copy_shape, i, ndim - * cdef int endian_detector = 1 - * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< * * ndim = PyArray_NDIM(self) */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1971,7 +2274,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1979,11 +2282,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1992,9 +2295,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2004,43 +2307,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2050,142 +2347,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2194,25 +2484,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2221,17 +2511,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2240,7 +2532,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2256,7 +2548,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2268,49 +2560,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2321,50 +2614,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2373,10 +2660,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2386,10 +2673,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2399,10 +2686,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2412,10 +2699,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2425,10 +2712,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2438,10 +2725,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2451,10 +2738,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2464,10 +2751,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2477,10 +2764,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2490,10 +2777,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2503,10 +2790,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2516,10 +2803,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2529,10 +2816,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2542,10 +2829,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2555,10 +2842,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2568,10 +2855,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2581,37 +2868,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2620,7 +2907,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2629,105 +2916,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2735,11 +3031,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2749,7 +3045,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2757,15 +3053,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2775,10 +3070,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2786,7 +3085,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2796,7 +3095,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2804,7 +3103,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2814,10 +3113,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2825,7 +3128,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2835,7 +3138,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2843,7 +3146,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2853,10 +3156,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2864,7 +3171,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2874,7 +3181,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2882,7 +3189,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2892,10 +3199,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2903,7 +3214,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2913,7 +3224,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2921,7 +3232,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2931,10 +3242,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2942,7 +3257,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2952,7 +3267,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2960,7 +3275,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2969,33 +3284,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3004,7 +3319,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3013,167 +3328,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3181,16 +3523,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3199,469 +3540,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3674,24 +3994,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3701,12 +4020,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3716,7 +4034,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3728,7 +4046,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3737,7 +4055,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3748,7 +4066,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3757,7 +4075,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3766,12 +4084,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3781,11 +4097,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3795,7 +4111,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3810,7 +4126,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3824,25 +4140,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("ols"), (PyCFunction)__pyx_pf_4nipy_4labs_3glm_6kalman_ols, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_3glm_6kalman_ols)}, - {__Pyx_NAMESTR("ar1"), (PyCFunction)__pyx_pf_4nipy_4labs_3glm_6kalman_ar1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_3glm_6kalman_ar1)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("kalman"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3854,61 +4165,291 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, + {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__S2, __pyx_k__S2, sizeof(__pyx_k__S2), 0, 0, 1, 1}, + {&__pyx_n_s__VB, __pyx_k__VB, sizeof(__pyx_k__VB), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, - {&__pyx_n_s__Vb, __pyx_k__Vb, sizeof(__pyx_k__Vb), 0, 0, 1, 1}, + {&__pyx_n_s__Vb_flat, __pyx_k__Vb_flat, sizeof(__pyx_k__Vb_flat), 0, 0, 1, 1}, {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__a, __pyx_k__a, sizeof(__pyx_k__a), 0, 0, 1, 1}, + {&__pyx_n_s__ar1, __pyx_k__ar1, sizeof(__pyx_k__ar1), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__dof, __pyx_k__dof, sizeof(__pyx_k__dof), 0, 0, 1, 1}, {&__pyx_n_s__double, __pyx_k__double, sizeof(__pyx_k__double), 0, 0, 1, 1}, {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, - {&__pyx_n_s__insert, __pyx_k__insert, sizeof(__pyx_k__insert), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__kfilt, __pyx_k__kfilt, sizeof(__pyx_k__kfilt), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, {&__pyx_n_s__niter, __pyx_k__niter, sizeof(__pyx_k__niter), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__ols, __pyx_k__ols, sizeof(__pyx_k__ols), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__p2, __pyx_k__p2, sizeof(__pyx_k__p2), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__rkfilt, __pyx_k__rkfilt, sizeof(__pyx_k__rkfilt), 0, 0, 1, 1}, {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__size2, __pyx_k__size2, sizeof(__pyx_k__size2), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__vector, __pyx_k__vector, sizeof(__pyx_k__vector), 0, 0, 1, 1}, + {&__pyx_n_s__vb, __pyx_k__vb, sizeof(__pyx_k__vb), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/glm/kalman.pyx":68 + * # Standard Kalman filter + * + * def ols(ndarray Y, ndarray X, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof) = ols(Y, X, axis=0). + */ + __pyx_k_tuple_15 = PyTuple_New(16); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 6, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__kfilt)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 7, ((PyObject *)__pyx_n_s__kfilt)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__kfilt)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 8, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 9, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dof)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 10, ((PyObject *)__pyx_n_s__dof)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dof)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 11, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 12, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 13, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VB)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 14, ((PyObject *)__pyx_n_s__VB)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VB)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 15, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(3, 0, 16, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__ols, 68, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/glm/kalman.pyx":142 + * + * + * def ar1(ndarray Y, ndarray X, int niter=2, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0) + */ + __pyx_k_tuple_19 = PyTuple_New(22); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__vb)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__vb)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vb)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__a)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__a)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__a)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Vb_flat)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__Vb_flat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Vb_flat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rkfilt)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__rkfilt)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rkfilt)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__p2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dof)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__dof)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dof)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 17, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VB)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 18, ((PyObject *)__pyx_n_s__VB)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VB)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 19, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 20, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 21, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(4, 0, 22, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__ar1, 142, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -3930,8 +4471,8 @@ PyMODINIT_FUNC PyInit_kalman(void) #endif { PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -3939,14 +4480,19 @@ PyMODINIT_FUNC PyInit_kalman(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_kalman(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_kalman(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3957,16 +4503,23 @@ PyMODINIT_FUNC PyInit_kalman(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("kalman"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("kalman"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.glm.kalman")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.glm.kalman", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3975,28 +4528,39 @@ PyMODINIT_FUNC PyInit_kalman(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":10 + /* "nipy/labs/glm/kalman.pyx":10 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * # Includes */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":62 + /* "nipy/labs/glm/kalman.pyx":62 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -4005,7 +4569,7 @@ PyMODINIT_FUNC PyInit_kalman(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":63 + /* "nipy/labs/glm/kalman.pyx":63 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -4014,63 +4578,107 @@ PyMODINIT_FUNC PyInit_kalman(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/glm/kalman.pyx":64 + /* "nipy/labs/glm/kalman.pyx":64 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * # Standard Kalman filter */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/glm/kalman.pyx":68 + * # Standard Kalman filter + * + * def ols(ndarray Y, ndarray X, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof) = ols(Y, X, axis=0). */ - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.glm.kalman"); - Py_DECREF(__pyx_m); __pyx_m = 0; - } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init nipy.labs.glm.kalman"); - } - __pyx_L0:; - __Pyx_RefNannyFinishContext(); - #if PY_MAJOR_VERSION < 3 - return; - #else - return __pyx_m; - #endif -} + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_3glm_6kalman_1ols, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ols, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static const char *__pyx_filenames[] = { - "kalman.pyx", - "numpy.pxd", -}; + /* "nipy/labs/glm/kalman.pyx":142 + * + * + * def ar1(ndarray Y, ndarray X, int niter=2, int axis=0): # <<<<<<<<<<<<<< + * """ + * (beta, norm_var_beta, s2, dof, a) = ar1(Y, X, niter=2, axis=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_3glm_6kalman_3ar1, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ar1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* Runtime support code */ + /* "nipy/labs/glm/kalman.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init nipy.labs.glm.kalman", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init nipy.labs.glm.kalman"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseArgtupleInvalid( @@ -4081,8 +4689,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4093,14 +4700,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -4115,55 +4731,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; } } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4182,42 +4820,265 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; } +#endif -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; } } - return item; + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); return -1; + } else { + return __Pyx_IterFinish(); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -4232,49 +5093,15 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(); - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -4290,38 +5117,73 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); } } @@ -4389,15 +5251,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4464,152 +5371,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -4783,6 +5598,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -4804,9 +5638,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -4839,9 +5673,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -4874,9 +5708,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -4909,9 +5743,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -4944,9 +5778,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -4979,9 +5813,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -4993,24 +5827,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5021,19 +5886,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -5042,54 +5911,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5100,28 +6024,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5129,11 +6070,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5168,11 +6107,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/group/glm_twolevel.c b/nipy/labs/group/glm_twolevel.c index 3afe86ae24..60d936e9e5 100644 --- a/nipy/labs/group/glm_twolevel.c +++ b/nipy/labs/group/glm_twolevel.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:44:47 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:36 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__group__glm_twolevel #define __PYX_HAVE_API__nipy__labs__group__glm_twolevel -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -163,120 +261,79 @@ #include "fff_array.h" #include "fffpy.h" #include "fff_glm_twolevel.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -287,8 +344,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -299,7 +354,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -307,52 +361,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "glm_twolevel.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -373,20 +590,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -397,52 +641,82 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -450,41 +724,58 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -498,7 +789,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -519,11 +809,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -534,7 +830,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -549,11 +848,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -564,14 +869,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -590,6 +893,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -602,63 +907,99 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.group.glm_twolevel */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.group.glm_twolevel' */ #define __Pyx_MODULE_NAME "nipy.labs.group.glm_twolevel" int __pyx_module_is_main_nipy__labs__group__glm_twolevel = 0; -/* Implementation of nipy.labs.group.glm_twolevel */ +/* Implementation of 'nipy.labs.group.glm_twolevel' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_VY, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_C, int __pyx_v_axis, int __pyx_v_niter); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_2log_likelihood(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Y, PyObject *__pyx_v_VY, PyObject *__pyx_v_X, PyObject *__pyx_v_B, PyObject *__pyx_v_S2, int __pyx_v_axis); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_4log_likelihood_ratio(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Y, PyObject *__pyx_v_VY, PyObject *__pyx_v_X, PyObject *__pyx_v_C, int __pyx_v_axis, int __pyx_v_niter); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_3[] = "ndarray is not C contiguous"; -static char __pyx_k_4[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_5[] = "Non-native byte order not supported"; -static char __pyx_k_6[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_7[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_8[] = "Format string allocated too short."; -static char __pyx_k_9[] = "\nTwo-level general linear model for group analyses.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_10[] = "0.1"; +static char __pyx_k_5[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_7[] = "Non-native byte order not supported"; +static char __pyx_k_9[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_10[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_13[] = "Format string allocated too short."; +static char __pyx_k_15[] = "\nTwo-level general linear model for group analyses.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_16[] = "0.1"; +static char __pyx_k_19[] = "/Users/mb312/dev_trees/nipy/nipy/labs/group/glm_twolevel.pyx"; +static char __pyx_k_20[] = "nipy.labs.group.glm_twolevel"; +static char __pyx_k_25[] = "log_likelihood_ratio"; +static char __pyx_k__A[] = "A"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; +static char __pyx_k__P[] = "P"; static char __pyx_k__Q[] = "Q"; static char __pyx_k__X[] = "X"; static char __pyx_k__Y[] = "Y"; @@ -669,64 +1010,67 @@ static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__p[] = "p"; static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__LL[] = "LL"; static char __pyx_k__S2[] = "S2"; static char __pyx_k__VY[] = "VY"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__em[] = "em"; +static char __pyx_k__ll[] = "ll"; static char __pyx_k__np[] = "np"; static char __pyx_k__s2[] = "s2"; -static char __pyx_k__buf[] = "buf"; +static char __pyx_k__vy[] = "vy"; +static char __pyx_k__PpX[] = "PpX"; static char __pyx_k__dot[] = "dot"; static char __pyx_k__eye[] = "eye"; static char __pyx_k__inv[] = "inv"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__lda[] = "lda"; +static char __pyx_k__ll0[] = "ll0"; +static char __pyx_k__ppx[] = "ppx"; +static char __pyx_k__tmp[] = "tmp"; static char __pyx_k__axis[] = "axis"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; +static char __pyx_k__dims[] = "dims"; static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__pinv[] = "pinv"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__multi[] = "multi"; static char __pyx_k__niter[] = "niter"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; static char __pyx_k__shape[] = "shape"; -static char __pyx_k__size1[] = "size1"; -static char __pyx_k__size2[] = "size2"; static char __pyx_k__zeros[] = "zeros"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; static char __pyx_k__linalg[] = "linalg"; -static char __pyx_k__vector[] = "vector"; static char __pyx_k__maximum[] = "maximum"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k____test__[] = "__test__"; static char __pyx_k__DEF_NITER[] = "DEF_NITER"; -static char __pyx_k__byteorder[] = "byteorder"; static char __pyx_k__transpose[] = "transpose"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__log_likelihood[] = "log_likelihood"; -static PyObject *__pyx_kp_s_10; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_n_s_20; +static PyObject *__pyx_n_s_25; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; static PyObject *__pyx_kp_u_7; -static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__A; static PyObject *__pyx_n_s__B; static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__DEF_NITER; +static PyObject *__pyx_n_s__LL; +static PyObject *__pyx_n_s__P; +static PyObject *__pyx_n_s__PpX; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__S2; static PyObject *__pyx_n_s__VY; @@ -734,149 +1078,143 @@ static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__X; static PyObject *__pyx_n_s__Y; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__axis; static PyObject *__pyx_n_s__b; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__dot; static PyObject *__pyx_n_s__em; static PyObject *__pyx_n_s__eye; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__inv; -static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__lda; static PyObject *__pyx_n_s__linalg; +static PyObject *__pyx_n_s__ll; +static PyObject *__pyx_n_s__ll0; static PyObject *__pyx_n_s__log_likelihood; static PyObject *__pyx_n_s__maximum; -static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__multi; +static PyObject *__pyx_n_s__n; static PyObject *__pyx_n_s__ndim; static PyObject *__pyx_n_s__niter; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__p; static PyObject *__pyx_n_s__pinv; +static PyObject *__pyx_n_s__ppx; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; static PyObject *__pyx_n_s__s2; static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__size; -static PyObject *__pyx_n_s__size1; -static PyObject *__pyx_n_s__size2; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__tmp; static PyObject *__pyx_n_s__transpose; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__vector; +static PyObject *__pyx_n_s__vy; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__y; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_15; static int __pyx_k_1; static int __pyx_k_2; - -/* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":46 - * DEF_NITER = 2 - * - * def em(ndarray Y, ndarray VY, ndarray X, ndarray C=None, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< - * """ - * b, s2 = em(y, vy, X, C=None, axis=0, niter=DEF_NITER). - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_17; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_codeobj_18; +static PyObject *__pyx_k_codeobj_22; +static PyObject *__pyx_k_codeobj_24; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_1em(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_4labs_5group_12glm_twolevel_em[] = "\n b, s2 = em(y, vy, X, C=None, axis=0, niter=DEF_NITER).\n\n Maximum likelihood regression in a mixed-effect GLM using the\n EM algorithm.\n\n C is the contrast matrix. Conventionally, C is p x q where p\n is the number of regressors. \n \n OUTPUT: beta, s2\n beta -- array of parameter estimates\n s2 -- array of squared scale parameters.\n \n REFERENCE:\n Keller and Roche, ISBI 2008.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_12glm_twolevel_1em = {__Pyx_NAMESTR("em"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_12glm_twolevel_1em, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_em)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_1em(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_VY = 0; PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_C = 0; int __pyx_v_axis; int __pyx_v_niter; - size_t __pyx_v_n; - size_t __pyx_v_p; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_vy; - fff_vector *__pyx_v_b; - fff_vector *__pyx_v_s2; - fff_matrix *__pyx_v_x; - fff_matrix *__pyx_v_ppx; - fff_glm_twolevel_EM *__pyx_v_em; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_PpX; - PyObject *__pyx_v_A; - PyObject *__pyx_v_B; - PyObject *__pyx_v_P; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_S2; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - int __pyx_t_10; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__C,&__pyx_n_s__axis,&__pyx_n_s__niter,0}; - __Pyx_RefNannySetupContext("em"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("em (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__C,&__pyx_n_s__axis,&__pyx_n_s__niter,0}; PyObject* values[6] = {0,0,0,0,0,0}; - values[3] = (PyObject*)((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("em", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("em", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + + /* "nipy/labs/group/glm_twolevel.pyx":46 + * DEF_NITER = 2 + * + * def em(ndarray Y, ndarray VY, ndarray X, ndarray C=None, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< + * """ + * b, s2 = em(y, vy, X, C=None, axis=0, niter=DEF_NITER). + */ + values[3] = (PyObject *)((PyArrayObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (unlikely(value)) { values[3] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("em", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("em", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[4] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "em") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "em") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_VY = ((PyArrayObject *)values[1]); __pyx_v_X = ((PyArrayObject *)values[2]); @@ -891,49 +1229,65 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s } else { __pyx_v_niter = __pyx_k_1; } - } else { - __pyx_v_C = ((PyArrayObject *)Py_None); - __pyx_v_axis = ((int)0); - __pyx_v_niter = __pyx_k_1; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_niter = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_niter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_C = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - case 3: - __pyx_v_X = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_VY = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("em", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.em"); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.em", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_VY); - __Pyx_INCREF((PyObject *)__pyx_v_X); - __Pyx_INCREF((PyObject *)__pyx_v_C); - __pyx_v_PpX = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_A = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_P = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_S2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_VY), __pyx_ptype_5numpy_ndarray, 1, "VY", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_C), __pyx_ptype_5numpy_ndarray, 1, "C", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(__pyx_self, __pyx_v_Y, __pyx_v_VY, __pyx_v_X, __pyx_v_C, __pyx_v_axis, __pyx_v_niter); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_VY, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_C, int __pyx_v_axis, int __pyx_v_niter) { + size_t __pyx_v_n; + size_t __pyx_v_p; + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_vy; + fff_vector *__pyx_v_b; + fff_vector *__pyx_v_s2; + fff_matrix *__pyx_v_x; + fff_matrix *__pyx_v_ppx; + fff_glm_twolevel_EM *__pyx_v_em; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_PpX = NULL; + PyObject *__pyx_v_A = NULL; + PyObject *__pyx_v_B = NULL; + PyObject *__pyx_v_P = NULL; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_S2 = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + size_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; + double __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("em", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":70 + /* "nipy/labs/group/glm_twolevel.pyx":70 * * # View on design matrix * x = fff_matrix_fromPyArray(X) # <<<<<<<<<<<<<< @@ -942,325 +1296,321 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_x = fff_matrix_fromPyArray(__pyx_v_X); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":73 + /* "nipy/labs/group/glm_twolevel.pyx":73 * * # Number of observations / regressors * n = x.size1 # <<<<<<<<<<<<<< * p = x.size2 * */ - __pyx_v_n = __pyx_v_x->size1; + __pyx_t_1 = __pyx_v_x->size1; + __pyx_v_n = __pyx_t_1; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":74 + /* "nipy/labs/group/glm_twolevel.pyx":74 * # Number of observations / regressors * n = x.size1 * p = x.size2 # <<<<<<<<<<<<<< * * # Compute the projected pseudo-inverse matrix */ - __pyx_v_p = __pyx_v_x->size2; + __pyx_t_1 = __pyx_v_x->size2; + __pyx_v_p = __pyx_t_1; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":77 + /* "nipy/labs/group/glm_twolevel.pyx":77 * * # Compute the projected pseudo-inverse matrix * if C == None: # <<<<<<<<<<<<<< * PpX = np.linalg.pinv(X) * else: */ - __pyx_t_1 = PyObject_RichCompare(((PyObject *)__pyx_v_C), Py_None, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_C), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":78 + /* "nipy/labs/group/glm_twolevel.pyx":78 * # Compute the projected pseudo-inverse matrix * if C == None: * PpX = np.linalg.pinv(X) # <<<<<<<<<<<<<< * else: * A = np.linalg.inv(np.dot(X.transpose(), X)) # (p,p) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pinv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__linalg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__pinv); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_X)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_PpX); - __pyx_v_PpX = __pyx_t_4; - __pyx_t_4 = 0; - goto __pyx_L6; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_PpX = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":80 + /* "nipy/labs/group/glm_twolevel.pyx":80 * PpX = np.linalg.pinv(X) * else: * A = np.linalg.inv(np.dot(X.transpose(), X)) # (p,p) # <<<<<<<<<<<<<< * B = np.linalg.inv(np.dot(np.dot(C.transpose(), A), C)) # (q,q) * P = np.eye(p) - np.dot(np.dot(np.dot(A, C), B), C.transpose()) # (p,p) */ + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__linalg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__inv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inv); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__transpose); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_6 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); __Pyx_INCREF(((PyObject *)__pyx_v_X)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_A); - __pyx_v_A = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_A = __pyx_t_6; + __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":81 + /* "nipy/labs/group/glm_twolevel.pyx":81 * else: * A = np.linalg.inv(np.dot(X.transpose(), X)) # (p,p) * B = np.linalg.inv(np.dot(np.dot(C.transpose(), A), C)) # (q,q) # <<<<<<<<<<<<<< * P = np.eye(p) - np.dot(np.dot(np.dot(A, C), B), C.transpose()) # (p,p) * PpX = np.dot(np.dot(P, A), X.transpose()) # (p,n) */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__inv); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__linalg); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_C), __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__inv); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__dot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_C), __pyx_n_s__transpose); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_A); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_A); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_A); __Pyx_GIVEREF(__pyx_v_A); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_v_C)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_C)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_C)); __Pyx_GIVEREF(((PyObject *)__pyx_v_C)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_B = __pyx_t_7; + __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":82 + /* "nipy/labs/group/glm_twolevel.pyx":82 * A = np.linalg.inv(np.dot(X.transpose(), X)) # (p,p) * B = np.linalg.inv(np.dot(np.dot(C.transpose(), A), C)) # (q,q) * P = np.eye(p) - np.dot(np.dot(np.dot(A, C), B), C.transpose()) # (p,p) # <<<<<<<<<<<<<< * PpX = np.dot(np.dot(P, A), X.transpose()) # (p,n) * ppx = fff_matrix_fromPyArray(PpX) */ + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eye); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__eye); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_A); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_A); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_A); __Pyx_GIVEREF(__pyx_v_A); __Pyx_INCREF(((PyObject *)__pyx_v_C)); - PyTuple_SET_ITEM(__pyx_t_5, 1, ((PyObject *)__pyx_v_C)); + PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_C)); __Pyx_GIVEREF(((PyObject *)__pyx_v_C)); - __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(__pyx_v_B); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_B); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_B); __Pyx_GIVEREF(__pyx_v_B); - __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_C), __pyx_n_s__transpose); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); - __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_7 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Subtract(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_C), __pyx_n_s__transpose); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_P); - __pyx_v_P = __pyx_t_5; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_8 = 0; __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Subtract(__pyx_t_7, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_P = __pyx_t_6; + __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":83 + /* "nipy/labs/group/glm_twolevel.pyx":83 * B = np.linalg.inv(np.dot(np.dot(C.transpose(), A), C)) # (q,q) * P = np.eye(p) - np.dot(np.dot(np.dot(A, C), B), C.transpose()) # (p,p) * PpX = np.dot(np.dot(P, A), X.transpose()) # (p,n) # <<<<<<<<<<<<<< * ppx = fff_matrix_fromPyArray(PpX) * */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dot); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_P); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_P); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_P); __Pyx_GIVEREF(__pyx_v_P); __Pyx_INCREF(__pyx_v_A); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_v_A); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_A); __Pyx_GIVEREF(__pyx_v_A); - __pyx_t_3 = PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__transpose); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__transpose); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __pyx_t_4 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_PpX); - __pyx_v_PpX = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_PpX = __pyx_t_7; + __pyx_t_7 = 0; } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":84 + /* "nipy/labs/group/glm_twolevel.pyx":84 * P = np.eye(p) - np.dot(np.dot(np.dot(A, C), B), C.transpose()) # (p,p) * PpX = np.dot(np.dot(P, A), X.transpose()) # (p,n) * ppx = fff_matrix_fromPyArray(PpX) # <<<<<<<<<<<<<< @@ -1268,65 +1618,35 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s * # Allocate output arrays */ if (!(likely(((__pyx_v_PpX) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_PpX, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_ppx = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_PpX)); + __pyx_t_7 = __pyx_v_PpX; + __Pyx_INCREF(__pyx_t_7); + __pyx_v_ppx = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_7)); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":87 + /* "nipy/labs/group/glm_twolevel.pyx":87 * * # Allocate output arrays * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< * dims[axis] = p * B = np.zeros(dims) */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_5 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { - __pyx_t_8 = 0; __pyx_t_4 = __pyx_t_5; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; - } else { - __pyx_t_5 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_5) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_5); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_5; - __pyx_t_5 = 0; - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_9])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyList_Append(__pyx_t_6, (PyObject*)__pyx_t_5); if (unlikely(__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = PyList_New(0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = __pyx_v_Y->nd; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + __pyx_t_6 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_PyList_Append(__pyx_t_7, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_6)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_6); - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = ((PyObject *)__pyx_t_7); + __Pyx_INCREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":88 + /* "nipy/labs/group/glm_twolevel.pyx":88 * # Allocate output arrays * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p # <<<<<<<<<<<<<< @@ -1335,10 +1655,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_t_6 = __Pyx_PyInt_FromSize_t(__pyx_v_p); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_6, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_6, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":89 + /* "nipy/labs/group/glm_twolevel.pyx":89 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = p * B = np.zeros(dims) # <<<<<<<<<<<<<< @@ -1347,32 +1667,32 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_v_B); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_v_B); __pyx_v_B = __pyx_t_5; __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":90 + /* "nipy/labs/group/glm_twolevel.pyx":90 * dims[axis] = p * B = np.zeros(dims) * dims[axis] = 1 # <<<<<<<<<<<<<< * S2 = np.zeros(dims) * */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":91 + /* "nipy/labs/group/glm_twolevel.pyx":91 * B = np.zeros(dims) * dims[axis] = 1 * S2 = np.zeros(dims) # <<<<<<<<<<<<<< @@ -1386,18 +1706,17 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_4 = PyObject_Call(__pyx_t_6, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_S2 = __pyx_t_7; + __pyx_t_7 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":94 + /* "nipy/labs/group/glm_twolevel.pyx":94 * * # Local structs * em = fff_glm_twolevel_EM_new(n, p) # <<<<<<<<<<<<<< @@ -1406,7 +1725,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_em = fff_glm_twolevel_EM_new(__pyx_v_n, __pyx_v_p); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":98 + /* "nipy/labs/group/glm_twolevel.pyx":98 * # Create a new array iterator * multi = fffpy_multi_iterator_new(4, axis, Y, VY, * B, S2) # <<<<<<<<<<<<<< @@ -1415,7 +1734,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_multi = fffpy_multi_iterator_new(4, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_VY), ((void *)__pyx_v_B), ((void *)__pyx_v_S2)); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":101 + /* "nipy/labs/group/glm_twolevel.pyx":101 * * # Create views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1424,7 +1743,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":102 + /* "nipy/labs/group/glm_twolevel.pyx":102 * # Create views * y = multi.vector[0] * vy = multi.vector[1] # <<<<<<<<<<<<<< @@ -1433,7 +1752,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_vy = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":103 + /* "nipy/labs/group/glm_twolevel.pyx":103 * y = multi.vector[0] * vy = multi.vector[1] * b = multi.vector[2] # <<<<<<<<<<<<<< @@ -1442,7 +1761,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_b = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":104 + /* "nipy/labs/group/glm_twolevel.pyx":104 * vy = multi.vector[1] * b = multi.vector[2] * s2 = multi.vector[3] # <<<<<<<<<<<<<< @@ -1451,7 +1770,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ __pyx_v_s2 = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":107 + /* "nipy/labs/group/glm_twolevel.pyx":107 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1459,10 +1778,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s * fff_glm_twolevel_EM_run(em, y, vy, x, ppx, niter) */ while (1) { - __pyx_t_2 = (__pyx_v_multi->index < __pyx_v_multi->size); - if (!__pyx_t_2) break; + __pyx_t_3 = (__pyx_v_multi->index < __pyx_v_multi->size); + if (!__pyx_t_3) break; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":108 + /* "nipy/labs/group/glm_twolevel.pyx":108 * # Loop * while(multi.index < multi.size): * fff_glm_twolevel_EM_init(em) # <<<<<<<<<<<<<< @@ -1471,7 +1790,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_glm_twolevel_EM_init(__pyx_v_em); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":109 + /* "nipy/labs/group/glm_twolevel.pyx":109 * while(multi.index < multi.size): * fff_glm_twolevel_EM_init(em) * fff_glm_twolevel_EM_run(em, y, vy, x, ppx, niter) # <<<<<<<<<<<<<< @@ -1480,7 +1799,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_glm_twolevel_EM_run(__pyx_v_em, __pyx_v_y, __pyx_v_vy, __pyx_v_x, __pyx_v_ppx, __pyx_v_niter); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":110 + /* "nipy/labs/group/glm_twolevel.pyx":110 * fff_glm_twolevel_EM_init(em) * fff_glm_twolevel_EM_run(em, y, vy, x, ppx, niter) * fff_vector_memcpy(b, em.b) # <<<<<<<<<<<<<< @@ -1489,16 +1808,17 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_vector_memcpy(__pyx_v_b, __pyx_v_em->b); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":111 + /* "nipy/labs/group/glm_twolevel.pyx":111 * fff_glm_twolevel_EM_run(em, y, vy, x, ppx, niter) * fff_vector_memcpy(b, em.b) * s2.data[0] = em.s2 # <<<<<<<<<<<<<< * fffpy_multi_iterator_update(multi) * */ - (__pyx_v_s2->data[0]) = __pyx_v_em->s2; + __pyx_t_11 = __pyx_v_em->s2; + (__pyx_v_s2->data[0]) = __pyx_t_11; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":112 + /* "nipy/labs/group/glm_twolevel.pyx":112 * fff_vector_memcpy(b, em.b) * s2.data[0] = em.s2 * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1508,7 +1828,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":115 + /* "nipy/labs/group/glm_twolevel.pyx":115 * * # Free memory * fff_matrix_delete(x) # <<<<<<<<<<<<<< @@ -1517,7 +1837,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_matrix_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":116 + /* "nipy/labs/group/glm_twolevel.pyx":116 * # Free memory * fff_matrix_delete(x) * fff_matrix_delete(ppx) # <<<<<<<<<<<<<< @@ -1526,7 +1846,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_matrix_delete(__pyx_v_ppx); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":117 + /* "nipy/labs/group/glm_twolevel.pyx":117 * fff_matrix_delete(x) * fff_matrix_delete(ppx) * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1535,7 +1855,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":118 + /* "nipy/labs/group/glm_twolevel.pyx":118 * fff_matrix_delete(ppx) * fffpy_multi_iterator_delete(multi) * fff_glm_twolevel_EM_delete(em) # <<<<<<<<<<<<<< @@ -1544,7 +1864,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s */ fff_glm_twolevel_EM_delete(__pyx_v_em); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":121 + /* "nipy/labs/group/glm_twolevel.pyx":121 * * # Return * return B, S2 # <<<<<<<<<<<<<< @@ -1552,136 +1872,117 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em(PyObject *__pyx_s * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_B); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_B); + PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_B); __Pyx_GIVEREF(__pyx_v_B); __Pyx_INCREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_S2); + PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_v_S2); __Pyx_GIVEREF(__pyx_v_S2); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_7); + __pyx_t_7 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.em"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.em", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_PpX); - __Pyx_DECREF(__pyx_v_A); - __Pyx_DECREF(__pyx_v_B); - __Pyx_DECREF(__pyx_v_P); - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_S2); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_VY); - __Pyx_DECREF((PyObject *)__pyx_v_X); - __Pyx_DECREF((PyObject *)__pyx_v_C); + __Pyx_XDECREF(__pyx_v_PpX); + __Pyx_XDECREF(__pyx_v_A); + __Pyx_XDECREF(__pyx_v_B); + __Pyx_XDECREF(__pyx_v_P); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_S2); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":126 - * - * - * def log_likelihood(Y, VY, X, B, S2, int axis=0): # <<<<<<<<<<<<<< - * """ - * ll = log_likelihood(y, vy, X, b, s2, axis=0) - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_12glm_twolevel_log_likelihood[] = "\n ll = log_likelihood(y, vy, X, b, s2, axis=0)\n Log likelihood in a mixed-effect GLM.\n OUTPUT: array\n REFERENCE:\n Keller and Roche, ISBI 2008.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_3log_likelihood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_12glm_twolevel_2log_likelihood[] = "\n ll = log_likelihood(y, vy, X, b, s2, axis=0)\n Log likelihood in a mixed-effect GLM.\n OUTPUT: array\n REFERENCE:\n Keller and Roche, ISBI 2008.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_12glm_twolevel_3log_likelihood = {__Pyx_NAMESTR("log_likelihood"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_12glm_twolevel_3log_likelihood, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_2log_likelihood)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_3log_likelihood(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_Y = 0; PyObject *__pyx_v_VY = 0; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_B = 0; PyObject *__pyx_v_S2 = 0; int __pyx_v_axis; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_vy; - fff_vector *__pyx_v_b; - fff_vector *__pyx_v_s2; - fff_vector *__pyx_v_ll; - fff_vector *__pyx_v_tmp; - fff_matrix *__pyx_v_x; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_LL; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - int __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__B,&__pyx_n_s__S2,&__pyx_n_s__axis,0}; - __Pyx_RefNannySetupContext("log_likelihood"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("log_likelihood (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__B,&__pyx_n_s__S2,&__pyx_n_s__axis,0}; PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__S2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__S2); - if (likely(values[4])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log_likelihood") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "log_likelihood") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = values[0]; __pyx_v_VY = values[1]; __pyx_v_X = values[2]; @@ -1692,38 +1993,55 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj } else { __pyx_v_axis = ((int)0); } - } else { - __pyx_v_axis = ((int)0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_S2 = PyTuple_GET_ITEM(__pyx_args, 4); - __pyx_v_B = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - __pyx_v_VY = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("log_likelihood", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood"); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF(__pyx_v_Y); - __Pyx_INCREF(__pyx_v_VY); - __Pyx_INCREF(__pyx_v_X); - __Pyx_INCREF(__pyx_v_B); - __Pyx_INCREF(__pyx_v_S2); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_LL = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_5group_12glm_twolevel_2log_likelihood(__pyx_self, __pyx_v_Y, __pyx_v_VY, __pyx_v_X, __pyx_v_B, __pyx_v_S2, __pyx_v_axis); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/group/glm_twolevel.pyx":126 + * + * + * def log_likelihood(Y, VY, X, B, S2, int axis=0): # <<<<<<<<<<<<<< + * """ + * ll = log_likelihood(y, vy, X, b, s2, axis=0) + */ + +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_2log_likelihood(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Y, PyObject *__pyx_v_VY, PyObject *__pyx_v_X, PyObject *__pyx_v_B, PyObject *__pyx_v_S2, int __pyx_v_axis) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_vy; + fff_vector *__pyx_v_b; + fff_vector *__pyx_v_s2; + fff_vector *__pyx_v_ll; + fff_vector *__pyx_v_tmp; + fff_matrix *__pyx_v_x; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_LL = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + PyObject *(*__pyx_t_5)(PyObject *); + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("log_likelihood", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":139 + /* "nipy/labs/group/glm_twolevel.pyx":139 * * # Allocate output array * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< @@ -1731,91 +2049,104 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj * LL = np.zeros(dims) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_Y, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_Y, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); __pyx_t_4 = 0; + __pyx_t_5 = NULL; } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_4 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = Py_TYPE(__pyx_t_3)->tp_iternext; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + if (!__pyx_t_5 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_5 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_3, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_t_5(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } break; } - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_Y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetItem(__pyx_t_3, __pyx_v_i); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_5); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_Y, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyObject_GetItem(__pyx_t_2, __pyx_v_i); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":140 + /* "nipy/labs/group/glm_twolevel.pyx":140 * # Allocate output array * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 # <<<<<<<<<<<<<< * LL = np.zeros(dims) * */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":141 + /* "nipy/labs/group/glm_twolevel.pyx":141 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 * LL = np.zeros(dims) # <<<<<<<<<<<<<< * * # View on design matrix */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_5 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_LL); - __pyx_v_LL = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_LL = __pyx_t_6; + __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":144 + /* "nipy/labs/group/glm_twolevel.pyx":144 * * # View on design matrix * x = fff_matrix_fromPyArray(X) # <<<<<<<<<<<<<< @@ -1823,9 +2154,12 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj * # Local structure */ if (!(likely(((__pyx_v_X) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_X, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_x = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_v_X)); + __pyx_t_6 = __pyx_v_X; + __Pyx_INCREF(__pyx_t_6); + __pyx_v_x = fff_matrix_fromPyArray(((PyArrayObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":147 + /* "nipy/labs/group/glm_twolevel.pyx":147 * * # Local structure * tmp = fff_vector_new(x.size1) # <<<<<<<<<<<<<< @@ -1834,7 +2168,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_tmp = fff_vector_new(__pyx_v_x->size1); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":151 + /* "nipy/labs/group/glm_twolevel.pyx":151 * # Multi iterator * multi = fffpy_multi_iterator_new(5, axis, Y, VY, * B, S2, LL) # <<<<<<<<<<<<<< @@ -1843,7 +2177,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_multi = fffpy_multi_iterator_new(5, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_VY), ((void *)__pyx_v_B), ((void *)__pyx_v_S2), ((void *)__pyx_v_LL)); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":154 + /* "nipy/labs/group/glm_twolevel.pyx":154 * * # View on iterable arrays * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1852,7 +2186,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":155 + /* "nipy/labs/group/glm_twolevel.pyx":155 * # View on iterable arrays * y = multi.vector[0] * vy = multi.vector[1] # <<<<<<<<<<<<<< @@ -1861,7 +2195,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_vy = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":156 + /* "nipy/labs/group/glm_twolevel.pyx":156 * y = multi.vector[0] * vy = multi.vector[1] * b = multi.vector[2] # <<<<<<<<<<<<<< @@ -1870,7 +2204,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_b = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":157 + /* "nipy/labs/group/glm_twolevel.pyx":157 * vy = multi.vector[1] * b = multi.vector[2] * s2 = multi.vector[3] # <<<<<<<<<<<<<< @@ -1879,7 +2213,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_s2 = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":158 + /* "nipy/labs/group/glm_twolevel.pyx":158 * b = multi.vector[2] * s2 = multi.vector[3] * ll = multi.vector[4] # <<<<<<<<<<<<<< @@ -1888,7 +2222,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ __pyx_v_ll = (__pyx_v_multi->vector[4]); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":161 + /* "nipy/labs/group/glm_twolevel.pyx":161 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1899,7 +2233,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj __pyx_t_7 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_7) break; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":162 + /* "nipy/labs/group/glm_twolevel.pyx":162 * # Loop * while(multi.index < multi.size): * ll.data[0] = fff_glm_twolevel_log_likelihood(y, vy, x, b, s2.data[0], tmp) # <<<<<<<<<<<<<< @@ -1908,7 +2242,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ (__pyx_v_ll->data[0]) = fff_glm_twolevel_log_likelihood(__pyx_v_y, __pyx_v_vy, __pyx_v_x, __pyx_v_b, (__pyx_v_s2->data[0]), __pyx_v_tmp); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":163 + /* "nipy/labs/group/glm_twolevel.pyx":163 * while(multi.index < multi.size): * ll.data[0] = fff_glm_twolevel_log_likelihood(y, vy, x, b, s2.data[0], tmp) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1918,7 +2252,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":166 + /* "nipy/labs/group/glm_twolevel.pyx":166 * * # Free memory * fff_matrix_delete(x) # <<<<<<<<<<<<<< @@ -1927,7 +2261,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ fff_matrix_delete(__pyx_v_x); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":167 + /* "nipy/labs/group/glm_twolevel.pyx":167 * # Free memory * fff_matrix_delete(x) * fff_vector_delete(tmp) # <<<<<<<<<<<<<< @@ -1936,7 +2270,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ fff_vector_delete(__pyx_v_tmp); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":168 + /* "nipy/labs/group/glm_twolevel.pyx":168 * fff_matrix_delete(x) * fff_vector_delete(tmp) * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1945,7 +2279,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":171 + /* "nipy/labs/group/glm_twolevel.pyx":171 * * # Return * return LL # <<<<<<<<<<<<<< @@ -1961,105 +2295,96 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood(PyObj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood"); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_LL); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF(__pyx_v_Y); - __Pyx_DECREF(__pyx_v_VY); - __Pyx_DECREF(__pyx_v_X); - __Pyx_DECREF(__pyx_v_B); - __Pyx_DECREF(__pyx_v_S2); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_LL); + __Pyx_XDECREF(__pyx_v_i); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":174 - * - * - * def log_likelihood_ratio(Y, VY, X, C, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< - * """ - * lda = em(y, vy, X, C, axis=0, niter=DEF_NITER). - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio[] = "\n lda = em(y, vy, X, C, axis=0, niter=DEF_NITER).\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_5log_likelihood_ratio(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_12glm_twolevel_4log_likelihood_ratio[] = "\n lda = em(y, vy, X, C, axis=0, niter=DEF_NITER).\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_12glm_twolevel_5log_likelihood_ratio = {__Pyx_NAMESTR("log_likelihood_ratio"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_12glm_twolevel_5log_likelihood_ratio, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_4log_likelihood_ratio)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_12glm_twolevel_5log_likelihood_ratio(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_Y = 0; PyObject *__pyx_v_VY = 0; PyObject *__pyx_v_X = 0; PyObject *__pyx_v_C = 0; int __pyx_v_axis; int __pyx_v_niter; - PyObject *__pyx_v_B; - PyObject *__pyx_v_S2; - PyObject *__pyx_v_ll0; - PyObject *__pyx_v_ll; - PyObject *__pyx_v_lda; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__C,&__pyx_n_s__axis,&__pyx_n_s__niter,0}; - __Pyx_RefNannySetupContext("log_likelihood_ratio"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("log_likelihood_ratio (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__VY,&__pyx_n_s__X,&__pyx_n_s__C,&__pyx_n_s__axis,&__pyx_n_s__niter,0}; PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VY)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[4] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "log_likelihood_ratio") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "log_likelihood_ratio") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = values[0]; __pyx_v_VY = values[1]; __pyx_v_X = values[2]; @@ -2074,37 +2399,47 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio } else { __pyx_v_niter = __pyx_k_2; } - } else { - __pyx_v_axis = ((int)0); - __pyx_v_niter = __pyx_k_2; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_niter = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_niter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_C = PyTuple_GET_ITEM(__pyx_args, 3); - __pyx_v_X = PyTuple_GET_ITEM(__pyx_args, 2); - __pyx_v_VY = PyTuple_GET_ITEM(__pyx_args, 1); - __pyx_v_Y = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("log_likelihood_ratio", 0, 4, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood_ratio"); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood_ratio", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_B = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_S2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_ll0 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_ll = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_lda = Py_None; __Pyx_INCREF(Py_None); + __pyx_r = __pyx_pf_4nipy_4labs_5group_12glm_twolevel_4log_likelihood_ratio(__pyx_self, __pyx_v_Y, __pyx_v_VY, __pyx_v_X, __pyx_v_C, __pyx_v_axis, __pyx_v_niter); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/group/glm_twolevel.pyx":174 + * + * + * def log_likelihood_ratio(Y, VY, X, C, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< + * """ + * lda = em(y, vy, X, C, axis=0, niter=DEF_NITER). + */ + +static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_4log_likelihood_ratio(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_Y, PyObject *__pyx_v_VY, PyObject *__pyx_v_X, PyObject *__pyx_v_C, int __pyx_v_axis, int __pyx_v_niter) { + PyObject *__pyx_v_B = NULL; + PyObject *__pyx_v_S2 = NULL; + PyObject *__pyx_v_ll0 = NULL; + PyObject *__pyx_v_ll = NULL; + PyObject *__pyx_v_lda = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *(*__pyx_t_5)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("log_likelihood_ratio", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":180 + /* "nipy/labs/group/glm_twolevel.pyx":180 * * # Constrained log-likelihood * B, S2 = em(Y, VY, X, C, axis, niter) # <<<<<<<<<<<<<< @@ -2137,40 +2472,65 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { - PyObject* tuple = __pyx_t_3; - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_4); - __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_4 = PyList_GET_ITEM(sequence, 0); + __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + #else + __pyx_t_4 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_1; - __pyx_t_1 = 0; - } else { + } else + { + Py_ssize_t index = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_2)->tp_iternext; + index = 0; __pyx_t_4 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_4)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_2); if (unlikely(!__pyx_t_1)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_EndUnpack(__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_4; - __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_1; - __pyx_t_1 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L4_unpacking_done:; } + __pyx_v_B = __pyx_t_4; + __pyx_t_4 = 0; + __pyx_v_S2 = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":181 + /* "nipy/labs/group/glm_twolevel.pyx":181 * # Constrained log-likelihood * B, S2 = em(Y, VY, X, C, axis, niter) * ll0 = log_likelihood(Y, VY, X, B, S2, axis) # <<<<<<<<<<<<<< @@ -2201,15 +2561,14 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_ll0); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_v_ll0 = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":184 + /* "nipy/labs/group/glm_twolevel.pyx":184 * * # Unconstrained log-likelihood * B, S2 = em(Y, VY, X, None, axis, niter) # <<<<<<<<<<<<<< @@ -2242,40 +2601,67 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio __Pyx_GIVEREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { - PyObject* tuple = __pyx_t_3; - __pyx_t_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { + PyObject* sequence = __pyx_t_3; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_1 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_2 = PyList_GET_ITEM(sequence, 0); + __pyx_t_1 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + #else + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_1; - __pyx_t_1 = 0; - } else { + } else + { + Py_ssize_t index = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = Py_TYPE(__pyx_t_4)->tp_iternext; + index = 0; __pyx_t_2 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_2)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + index = 1; __pyx_t_1 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_1)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_B); - __pyx_v_B = __pyx_t_2; - __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_1; - __pyx_t_1 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + __Pyx_DECREF(__pyx_v_B); + __pyx_v_B = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_S2); + __pyx_v_S2 = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":185 + /* "nipy/labs/group/glm_twolevel.pyx":185 * # Unconstrained log-likelihood * B, S2 = em(Y, VY, X, None, axis, niter) * ll = log_likelihood(Y, VY, X, B, S2, axis) # <<<<<<<<<<<<<< @@ -2306,15 +2692,14 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio PyTuple_SET_ITEM(__pyx_t_2, 5, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_ll); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_ll = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":188 + /* "nipy/labs/group/glm_twolevel.pyx":188 * * # -2 log R = 2*(ll-ll0) * lda = 2*(ll-ll0) # <<<<<<<<<<<<<< @@ -2325,11 +2710,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_lda); __pyx_v_lda = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":189 + /* "nipy/labs/group/glm_twolevel.pyx":189 * # -2 log R = 2*(ll-ll0) * lda = 2*(ll-ll0) * return np.maximum(lda, 0.0) # <<<<<<<<<<<<<< @@ -2350,10 +2734,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; @@ -2365,20 +2749,31 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood_ratio"); + __Pyx_AddTraceback("nipy.labs.group.glm_twolevel.log_likelihood_ratio", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_B); - __Pyx_DECREF(__pyx_v_S2); - __Pyx_DECREF(__pyx_v_ll0); - __Pyx_DECREF(__pyx_v_ll); - __Pyx_DECREF(__pyx_v_lda); + __Pyx_XDECREF(__pyx_v_B); + __Pyx_XDECREF(__pyx_v_S2); + __Pyx_XDECREF(__pyx_v_ll0); + __Pyx_XDECREF(__pyx_v_ll); + __Pyx_XDECREF(__pyx_v_lda); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -2386,8 +2781,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -2399,23 +2793,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -2423,7 +2836,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2432,16 +2845,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2451,7 +2864,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2459,11 +2872,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2472,9 +2885,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2484,43 +2897,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2530,142 +2937,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2674,25 +3074,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2701,17 +3101,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2720,7 +3122,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2736,7 +3138,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2748,49 +3150,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2801,50 +3204,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2853,10 +3250,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2866,10 +3263,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2879,10 +3276,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2892,10 +3289,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2905,10 +3302,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2918,10 +3315,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2931,10 +3328,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2944,10 +3341,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2957,10 +3354,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2970,10 +3367,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2983,10 +3380,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2996,10 +3393,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3009,10 +3406,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3022,10 +3419,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3035,10 +3432,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3048,10 +3445,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -3061,37 +3458,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -3100,7 +3497,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -3109,105 +3506,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3215,11 +3621,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3229,7 +3635,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3237,15 +3643,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3255,10 +3660,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3266,7 +3675,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3276,7 +3685,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3284,7 +3693,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3294,10 +3703,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3305,7 +3718,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3315,7 +3728,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3323,7 +3736,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3333,10 +3746,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3344,7 +3761,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3354,7 +3771,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3362,7 +3779,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3372,10 +3789,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3383,7 +3804,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3393,7 +3814,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3401,7 +3822,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3411,10 +3832,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3422,7 +3847,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3432,7 +3857,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3440,7 +3865,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -3449,33 +3874,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3484,7 +3909,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3493,167 +3918,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3661,16 +4113,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3679,469 +4130,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_9), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4154,24 +4584,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4181,12 +4610,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -4196,7 +4624,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -4208,7 +4636,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4217,7 +4645,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4228,7 +4656,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4237,7 +4665,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4246,12 +4674,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4261,11 +4687,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4275,7 +4701,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4290,7 +4716,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4304,26 +4730,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("em"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_12glm_twolevel_em, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_em)}, - {__Pyx_NAMESTR("log_likelihood"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_log_likelihood)}, - {__Pyx_NAMESTR("log_likelihood_ratio"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_12glm_twolevel_log_likelihood_ratio)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("glm_twolevel"), - __Pyx_DOCSTR(__pyx_k_9), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_15), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -4334,16 +4754,23 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, + {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, - {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__DEF_NITER, __pyx_k__DEF_NITER, sizeof(__pyx_k__DEF_NITER), 0, 0, 1, 1}, + {&__pyx_n_s__LL, __pyx_k__LL, sizeof(__pyx_k__LL), 0, 0, 1, 1}, + {&__pyx_n_s__P, __pyx_k__P, sizeof(__pyx_k__P), 0, 0, 1, 1}, + {&__pyx_n_s__PpX, __pyx_k__PpX, sizeof(__pyx_k__PpX), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__S2, __pyx_k__S2, sizeof(__pyx_k__S2), 0, 0, 1, 1}, {&__pyx_n_s__VY, __pyx_k__VY, sizeof(__pyx_k__VY), 0, 0, 1, 1}, @@ -4351,53 +4778,331 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1}, {&__pyx_n_s__em, __pyx_k__em, sizeof(__pyx_k__em), 0, 0, 1, 1}, {&__pyx_n_s__eye, __pyx_k__eye, sizeof(__pyx_k__eye), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__inv, __pyx_k__inv, sizeof(__pyx_k__inv), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__lda, __pyx_k__lda, sizeof(__pyx_k__lda), 0, 0, 1, 1}, {&__pyx_n_s__linalg, __pyx_k__linalg, sizeof(__pyx_k__linalg), 0, 0, 1, 1}, + {&__pyx_n_s__ll, __pyx_k__ll, sizeof(__pyx_k__ll), 0, 0, 1, 1}, + {&__pyx_n_s__ll0, __pyx_k__ll0, sizeof(__pyx_k__ll0), 0, 0, 1, 1}, {&__pyx_n_s__log_likelihood, __pyx_k__log_likelihood, sizeof(__pyx_k__log_likelihood), 0, 0, 1, 1}, {&__pyx_n_s__maximum, __pyx_k__maximum, sizeof(__pyx_k__maximum), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, {&__pyx_n_s__niter, __pyx_k__niter, sizeof(__pyx_k__niter), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, {&__pyx_n_s__pinv, __pyx_k__pinv, sizeof(__pyx_k__pinv), 0, 0, 1, 1}, + {&__pyx_n_s__ppx, __pyx_k__ppx, sizeof(__pyx_k__ppx), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, - {&__pyx_n_s__size1, __pyx_k__size1, sizeof(__pyx_k__size1), 0, 0, 1, 1}, - {&__pyx_n_s__size2, __pyx_k__size2, sizeof(__pyx_k__size2), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__tmp, __pyx_k__tmp, sizeof(__pyx_k__tmp), 0, 0, 1, 1}, {&__pyx_n_s__transpose, __pyx_k__transpose, sizeof(__pyx_k__transpose), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__vector, __pyx_k__vector, sizeof(__pyx_k__vector), 0, 0, 1, 1}, + {&__pyx_n_s__vy, __pyx_k__vy, sizeof(__pyx_k__vy), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_11 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_10)); + PyTuple_SET_ITEM(__pyx_k_tuple_11, 0, ((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "nipy/labs/group/glm_twolevel.pyx":46 + * DEF_NITER = 2 + * + * def em(ndarray Y, ndarray VY, ndarray X, ndarray C=None, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< + * """ + * b, s2 = em(y, vy, X, C=None, axis=0, niter=DEF_NITER). + */ + __pyx_k_tuple_17 = PyTuple_New(23); if (unlikely(!__pyx_k_tuple_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_17); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VY)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 1, ((PyObject *)__pyx_n_s__VY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VY)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 3, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 4, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 5, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 6, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__p)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 7, ((PyObject *)__pyx_n_s__p)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__p)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 8, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__vy)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 9, ((PyObject *)__pyx_n_s__vy)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vy)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 10, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 11, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 12, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ppx)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 13, ((PyObject *)__pyx_n_s__ppx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ppx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__em)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 14, ((PyObject *)__pyx_n_s__em)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__em)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 15, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__PpX)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 16, ((PyObject *)__pyx_n_s__PpX)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__PpX)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 17, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 18, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__P)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 19, ((PyObject *)__pyx_n_s__P)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__P)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 20, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 21, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_17, 22, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_17)); + __pyx_k_codeobj_18 = (PyObject*)__Pyx_PyCode_New(6, 0, 23, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__em, 46, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/glm_twolevel.pyx":126 + * + * + * def log_likelihood(Y, VY, X, B, S2, int axis=0): # <<<<<<<<<<<<<< + * """ + * ll = log_likelihood(y, vy, X, b, s2, axis=0) + */ + __pyx_k_tuple_21 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VY)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__VY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VY)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 5, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 6, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__vy)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 7, ((PyObject *)__pyx_n_s__vy)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vy)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__b)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 8, ((PyObject *)__pyx_n_s__b)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__b)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 9, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ll)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 10, ((PyObject *)__pyx_n_s__ll)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ll)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__tmp)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 11, ((PyObject *)__pyx_n_s__tmp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__tmp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__x)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 12, ((PyObject *)__pyx_n_s__x)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__x)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 13, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 14, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__LL)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 15, ((PyObject *)__pyx_n_s__LL)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__LL)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 16, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s__log_likelihood, 126, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/glm_twolevel.pyx":174 + * + * + * def log_likelihood_ratio(Y, VY, X, C, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< + * """ + * lda = em(y, vy, X, C, axis=0, niter=DEF_NITER). + */ + __pyx_k_tuple_23 = PyTuple_New(11); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__VY)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__VY)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__VY)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__X)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__X)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__X)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__C)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__C)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__C)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ll0)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__ll0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ll0)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__ll)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 9, ((PyObject *)__pyx_n_s__ll)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__ll)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__lda)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 10, ((PyObject *)__pyx_n_s__lda)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__lda)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(6, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_19, __pyx_n_s_25, 174, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -4421,8 +5126,8 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) { PyObject *__pyx_t_1 = NULL; int __pyx_t_2; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -4430,14 +5135,19 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_glm_twolevel(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_glm_twolevel(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -4448,16 +5158,23 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("glm_twolevel"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_9), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("glm_twolevel"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_15), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.group.glm_twolevel")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.group.glm_twolevel", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4466,28 +5183,39 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":8 + /* "nipy/labs/group/glm_twolevel.pyx":8 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * # Includes */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_10)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_16)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":39 + /* "nipy/labs/group/glm_twolevel.pyx":39 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -4496,7 +5224,7 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":40 + /* "nipy/labs/group/glm_twolevel.pyx":40 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -4505,19 +5233,19 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":41 + /* "nipy/labs/group/glm_twolevel.pyx":41 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * # Constants */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":44 + /* "nipy/labs/group/glm_twolevel.pyx":44 * * # Constants * DEF_NITER = 2 # <<<<<<<<<<<<<< @@ -4526,7 +5254,7 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__DEF_NITER, __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":46 + /* "nipy/labs/group/glm_twolevel.pyx":46 * DEF_NITER = 2 * * def em(ndarray Y, ndarray VY, ndarray X, ndarray C=None, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< @@ -4538,8 +5266,24 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_1 = __pyx_t_2; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_12glm_twolevel_1em, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__em, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/glm_twolevel.pyx":126 + * + * + * def log_likelihood(Y, VY, X, B, S2, int axis=0): # <<<<<<<<<<<<<< + * """ + * ll = log_likelihood(y, vy, X, b, s2, axis=0) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_12glm_twolevel_3log_likelihood, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__log_likelihood, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/glm_twolevel.pyx":174 + /* "nipy/labs/group/glm_twolevel.pyx":174 * * * def log_likelihood_ratio(Y, VY, X, C, int axis=0, int niter=DEF_NITER): # <<<<<<<<<<<<<< @@ -4551,17 +5295,33 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_k_2 = __pyx_t_2; + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_12glm_twolevel_5log_likelihood_ratio, NULL, __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_25, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/glm_twolevel.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * """ + * Two-level general linear model for group analyses. + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.group.glm_twolevel"); + __Pyx_AddTraceback("init nipy.labs.group.glm_twolevel", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.group.glm_twolevel"); @@ -4575,28 +5335,36 @@ PyMODINIT_FUNC PyInit_glm_twolevel(void) #endif } -static const char *__pyx_filenames[] = { - "glm_twolevel.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseArgtupleInvalid( @@ -4607,8 +5375,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4619,14 +5386,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -4641,55 +5417,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4708,6 +5506,26 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -4720,87 +5538,256 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, - #else - "need more than %zd value%s to unpack", index, - #endif - (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; } } - return item; + return 0; +#endif } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); return -1; + } else { + return __Pyx_IterFinish(); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); } else { - __Pyx_RaiseTooManyValuesError(); + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - else { - if (PyObject_TypeCheck(obj, type)) return 1; + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -4816,38 +5803,73 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); } } @@ -4915,15 +5937,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4990,152 +6057,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -5309,6 +6284,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -5330,9 +6324,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -5365,9 +6359,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -5400,9 +6394,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -5435,9 +6429,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -5470,9 +6464,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -5505,9 +6499,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -5519,24 +6513,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5547,19 +6572,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -5568,54 +6597,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5626,28 +6710,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5655,11 +6756,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5694,11 +6793,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/group/onesample.c b/nipy/labs/group/onesample.c index c767ec1ff9..e84789f10d 100644 --- a/nipy/labs/group/onesample.c +++ b/nipy/labs/group/onesample.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:45:13 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:37 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__group__onesample #define __PYX_HAVE_API__nipy__labs__group__onesample -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -163,120 +261,79 @@ #include "fff_array.h" #include "fffpy.h" #include "fff_onesample_stat.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -287,8 +344,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -299,7 +354,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -307,52 +361,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "onesample.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -373,20 +590,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -397,50 +641,80 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -448,43 +722,60 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -498,7 +789,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -519,11 +809,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -534,7 +830,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -549,11 +848,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -564,14 +869,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -590,6 +893,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -602,65 +907,102 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.group.onesample */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.group.onesample' */ #define __Pyx_MODULE_NAME "nipy.labs.group.onesample" int __pyx_module_is_main_nipy__labs__group__onesample = 0; -/* Implementation of nipy.labs.group.onesample */ +/* Implementation of 'nipy.labs.group.onesample' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyObject *__pyx_v_id, double __pyx_v_base, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_2stat_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, PyObject *__pyx_v_id, double __pyx_v_base, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics, unsigned int __pyx_v_niter); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_4pdf_fit_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, int __pyx_v_axis, int __pyx_v_niter, int __pyx_v_constraint, double __pyx_v_base); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_6pdf_fit_gmfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, int __pyx_v_axis, int __pyx_v_niter, int __pyx_v_constraint, double __pyx_v_base); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nRoutines for massively univariate random-effect and mixed-effect analysis.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nRoutines for massively univariate random-effect and mixed-effect analysis.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/group/onesample.pyx"; +static char __pyx_k_18[] = "nipy.labs.group.onesample"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; +static char __pyx_k__T[] = "T"; static char __pyx_k__V[] = "V"; +static char __pyx_k__W[] = "W"; static char __pyx_k__Y[] = "Y"; +static char __pyx_k__Z[] = "Z"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; @@ -668,224 +1010,239 @@ static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; +static char __pyx_k__n[] = "n"; static char __pyx_k__q[] = "q"; +static char __pyx_k__t[] = "t"; +static char __pyx_k__v[] = "v"; +static char __pyx_k__w[] = "w"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__z[] = "z"; +static char __pyx_k__MU[] = "MU"; +static char __pyx_k__S2[] = "S2"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__id[] = "id"; +static char __pyx_k__mu[] = "mu"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; +static char __pyx_k__s2[] = "s2"; +static char __pyx_k__yp[] = "yp"; static char __pyx_k__elr[] = "elr"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__idx[] = "idx"; static char __pyx_k__axis[] = "axis"; static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; +static char __pyx_k__dims[] = "dims"; static char __pyx_k__mean[] = "mean"; -static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__sign[] = "sign"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__descr[] = "descr"; +static char __pyx_k__simu[] = "simu"; +static char __pyx_k__stat[] = "stat"; static char __pyx_k__grubb[] = "grubb"; -static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__magic[] = "magic"; +static char __pyx_k__multi[] = "multi"; static char __pyx_k__niter[] = "niter"; +static char __pyx_k__nsimu[] = "nsimu"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; static char __pyx_k__stats[] = "stats"; static char __pyx_k__tukey[] = "tukey"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__Magics[] = "Magics"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; +static char __pyx_k__magics[] = "magics"; static char __pyx_k__median[] = "median"; -static char __pyx_k__stride[] = "stride"; -static char __pyx_k__vector[] = "vector"; static char __pyx_k__elr_mfx[] = "elr_mfx"; static char __pyx_k__laplace[] = "laplace"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k__student[] = "student"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k____test__[] = "__test__"; static char __pyx_k__mean_mfx[] = "mean_mfx"; -static char __pyx_k__readonly[] = "readonly"; static char __pyx_k__sign_mfx[] = "sign_mfx"; -static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__stat_mfx[] = "stat_mfx"; static char __pyx_k__wilcoxon[] = "wilcoxon"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__flag_stat[] = "flag_stat"; +static char __pyx_k__nsimu_max[] = "nsimu_max"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k__constraint[] = "constraint"; static char __pyx_k__median_mfx[] = "median_mfx"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; +static char __pyx_k__pdf_fit_mfx[] = "pdf_fit_mfx"; static char __pyx_k__student_mfx[] = "student_mfx"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__pdf_fit_gmfx[] = "pdf_fit_gmfx"; static char __pyx_k__wilcoxon_mfx[] = "wilcoxon_mfx"; static char __pyx_k__mean_gauss_mfx[] = "mean_gauss_mfx"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_n_s__MU; static PyObject *__pyx_n_s__Magics; static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__S2; +static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__V; static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__W; static PyObject *__pyx_n_s__Y; +static PyObject *__pyx_n_s__Z; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__axis; static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__constraint; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dims; static PyObject *__pyx_n_s__elr; static PyObject *__pyx_n_s__elr_mfx; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__flag_stat; static PyObject *__pyx_n_s__grubb; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__id; -static PyObject *__pyx_n_s__index; -static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__idx; static PyObject *__pyx_n_s__laplace; +static PyObject *__pyx_n_s__magic; +static PyObject *__pyx_n_s__magics; static PyObject *__pyx_n_s__mean; static PyObject *__pyx_n_s__mean_gauss_mfx; static PyObject *__pyx_n_s__mean_mfx; static PyObject *__pyx_n_s__median; static PyObject *__pyx_n_s__median_mfx; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__mu; +static PyObject *__pyx_n_s__multi; +static PyObject *__pyx_n_s__n; static PyObject *__pyx_n_s__niter; static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__nsimu; +static PyObject *__pyx_n_s__nsimu_max; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__pdf_fit_gmfx; +static PyObject *__pyx_n_s__pdf_fit_mfx; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__s2; static PyObject *__pyx_n_s__sign; static PyObject *__pyx_n_s__sign_mfx; -static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__simu; +static PyObject *__pyx_n_s__stat; +static PyObject *__pyx_n_s__stat_mfx; static PyObject *__pyx_n_s__stats; -static PyObject *__pyx_n_s__stride; -static PyObject *__pyx_n_s__strides; static PyObject *__pyx_n_s__student; static PyObject *__pyx_n_s__student_mfx; -static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__t; static PyObject *__pyx_n_s__tukey; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__vector; +static PyObject *__pyx_n_s__v; +static PyObject *__pyx_n_s__w; static PyObject *__pyx_n_s__wilcoxon; static PyObject *__pyx_n_s__wilcoxon_mfx; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__yp; +static PyObject *__pyx_n_s__z; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_1; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":88 - * - * # Test stat without mixed-effect correction - * def stat(ndarray Y, id='student', double base=0.0, # <<<<<<<<<<<<<< - * int axis=0, ndarray Magics=None): - * """ - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_22; +static PyObject *__pyx_k_codeobj_24; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_1stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_4nipy_4labs_5group_9onesample_stat[] = "\n T = stat(Y, id='student', base=0.0, axis=0, magics=None).\n \n Compute a one-sample test statistic over a number of deterministic\n or random permutations. \n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9onesample_1stat = {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9onesample_1stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_stat)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_1stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyObject *__pyx_v_id = 0; double __pyx_v_base; int __pyx_v_axis; PyArrayObject *__pyx_v_Magics = 0; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_t; - fff_vector *__pyx_v_magics; - fff_vector *__pyx_v_yp; - fff_onesample_stat *__pyx_v_stat; - fff_onesample_stat_flag __pyx_v_flag_stat; - unsigned int __pyx_v_n; - unsigned long __pyx_v_simu; - unsigned long __pyx_v_nsimu; - unsigned long __pyx_v_idx; - double __pyx_v_magic; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_T; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - fff_onesample_stat_flag __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - unsigned long __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__id,&__pyx_n_s__base,&__pyx_n_s__axis,&__pyx_n_s__Magics,0}; - __Pyx_RefNannySetupContext("stat"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stat (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__id,&__pyx_n_s__base,&__pyx_n_s__axis,&__pyx_n_s__Magics,0}; + PyObject* values[5] = {0,0,0,0,0}; + values[1] = ((PyObject *)__pyx_n_s__student); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":89 + /* "nipy/labs/group/onesample.pyx":89 * # Test stat without mixed-effect correction * def stat(ndarray Y, id='student', double base=0.0, * int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< * """ * T = stat(Y, id='student', base=0.0, axis=0, magics=None). */ - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[5] = {0,0,0,0,0}; - values[1] = ((PyObject *)__pyx_n_s__student); - values[4] = (PyObject*)((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); - if (unlikely(value)) { values[1] = value; kw_args--; } + values[4] = (PyObject *)((PyArrayObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); - if (unlikely(value)) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (value) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); + if (value) { values[4] = value; kw_args--; } + } } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[3] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); - if (unlikely(value)) { values[4] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "stat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_id = values[1]; if (values[2]) { __pyx_v_base = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":88 + /* "nipy/labs/group/onesample.pyx":88 * * # Test stat without mixed-effect correction * def stat(ndarray Y, id='student', double base=0.0, # <<<<<<<<<<<<<< @@ -900,46 +1257,59 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel __pyx_v_axis = ((int)0); } __pyx_v_Magics = ((PyArrayObject *)values[4]); - } else { - __pyx_v_id = ((PyObject *)__pyx_n_s__student); - __pyx_v_base = ((double)0.0); - __pyx_v_axis = ((int)0); - - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":89 - * # Test stat without mixed-effect correction - * def stat(ndarray Y, id='student', double base=0.0, - * int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< - * """ - * T = stat(Y, id='student', base=0.0, axis=0, magics=None). - */ - __pyx_v_Magics = ((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: __pyx_v_Magics = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - case 4: __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: __pyx_v_base = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("stat", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.onesample.stat"); + __Pyx_AddTraceback("nipy.labs.group.onesample.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF(__pyx_v_id); - __Pyx_INCREF((PyObject *)__pyx_v_Magics); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_T = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Magics), __pyx_ptype_5numpy_ndarray, 1, "Magics", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_9onesample_stat(__pyx_self, __pyx_v_Y, __pyx_v_id, __pyx_v_base, __pyx_v_axis, __pyx_v_Magics); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyObject *__pyx_v_id, double __pyx_v_base, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_t; + fff_vector *__pyx_v_magics; + fff_vector *__pyx_v_yp; + fff_onesample_stat *__pyx_v_stat; + fff_onesample_stat_flag __pyx_v_flag_stat; + unsigned int __pyx_v_n; + unsigned long __pyx_v_simu; + unsigned long __pyx_v_nsimu; + unsigned long __pyx_v_idx; + double __pyx_v_magic; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_T = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + fff_onesample_stat_flag __pyx_t_3; + int __pyx_t_4; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + unsigned long __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stat", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":98 + /* "nipy/labs/group/onesample.pyx":98 * cdef fff_vector *y, *t, *magics, *yp * cdef fff_onesample_stat* stat * cdef fff_onesample_stat_flag flag_stat = stats[id] # <<<<<<<<<<<<<< @@ -955,7 +1325,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_flag_stat = __pyx_t_3; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":105 + /* "nipy/labs/group/onesample.pyx":105 * * # Get number of observations * n = Y.shape[axis] # <<<<<<<<<<<<<< @@ -964,20 +1334,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_n = ((unsigned int)(__pyx_v_Y->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":108 + /* "nipy/labs/group/onesample.pyx":108 * * # Read out magic numbers * if Magics == None: # <<<<<<<<<<<<<< * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":109 + /* "nipy/labs/group/onesample.pyx":109 * # Read out magic numbers * if Magics == None: * magics = fff_vector_new(1) # <<<<<<<<<<<<<< @@ -986,19 +1355,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_magics = fff_vector_new(1); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":110 + /* "nipy/labs/group/onesample.pyx":110 * if Magics == None: * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure # <<<<<<<<<<<<<< * else: * magics = fff_vector_fromPyArray(Magics) */ - (__pyx_v_magics->data[0]) = 0; - goto __pyx_L6; + (__pyx_v_magics->data[0]) = 0.0; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":112 + /* "nipy/labs/group/onesample.pyx":112 * magics.data[0] = 0 ## Just to make sure * else: * magics = fff_vector_fromPyArray(Magics) # <<<<<<<<<<<<<< @@ -1007,18 +1376,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_magics = fff_vector_fromPyArray(__pyx_v_Magics); } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":115 + /* "nipy/labs/group/onesample.pyx":115 * * # Create output array * nsimu = magics.size # <<<<<<<<<<<<<< * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu */ - __pyx_v_nsimu = __pyx_v_magics->size; + __pyx_t_5 = __pyx_v_magics->size; + __pyx_v_nsimu = __pyx_t_5; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":116 + /* "nipy/labs/group/onesample.pyx":116 * # Create output array * nsimu = magics.size * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< @@ -1026,92 +1396,58 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel * T = np.zeros(dims) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = 0; __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); - } else { - __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else { - __pyx_t_1 = PyIter_Next(__pyx_t_6); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_7])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_Y->nd; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":117 + /* "nipy/labs/group/onesample.pyx":117 * nsimu = magics.size * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu # <<<<<<<<<<<<<< * T = np.zeros(dims) * */ - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_2, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":118 + /* "nipy/labs/group/onesample.pyx":118 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu * T = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_T); - __pyx_v_T = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_T = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":121 + /* "nipy/labs/group/onesample.pyx":121 * * # Create local structure * stat = fff_onesample_stat_new(n, flag_stat, base) # <<<<<<<<<<<<<< @@ -1120,7 +1456,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_stat = fff_onesample_stat_new(__pyx_v_n, __pyx_v_flag_stat, __pyx_v_base); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":122 + /* "nipy/labs/group/onesample.pyx":122 * # Create local structure * stat = fff_onesample_stat_new(n, flag_stat, base) * yp = fff_vector_new(n) # <<<<<<<<<<<<<< @@ -1129,7 +1465,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_yp = fff_vector_new(__pyx_v_n); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":125 + /* "nipy/labs/group/onesample.pyx":125 * * # Multi-iterator * multi = fffpy_multi_iterator_new(2, axis, Y, T) # <<<<<<<<<<<<<< @@ -1138,7 +1474,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_multi = fffpy_multi_iterator_new(2, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_T)); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":128 + /* "nipy/labs/group/onesample.pyx":128 * * # Vector views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1147,7 +1483,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":129 + /* "nipy/labs/group/onesample.pyx":129 * # Vector views * y = multi.vector[0] * t = multi.vector[1] # <<<<<<<<<<<<<< @@ -1156,7 +1492,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_t = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":132 + /* "nipy/labs/group/onesample.pyx":132 * * # Loop * for simu from 0 <= simu < nsimu: # <<<<<<<<<<<<<< @@ -1166,7 +1502,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel __pyx_t_9 = __pyx_v_nsimu; for (__pyx_v_simu = 0; __pyx_v_simu < __pyx_t_9; __pyx_v_simu++) { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":135 + /* "nipy/labs/group/onesample.pyx":135 * * # Set the magic number * magic = magics.data[simu*magics.stride] # <<<<<<<<<<<<<< @@ -1175,7 +1511,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_magic = (__pyx_v_magics->data[(__pyx_v_simu * __pyx_v_magics->stride)]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":138 + /* "nipy/labs/group/onesample.pyx":138 * * # Reset the multi-iterator * fffpy_multi_iterator_reset(multi); # <<<<<<<<<<<<<< @@ -1184,7 +1520,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fffpy_multi_iterator_reset(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":141 + /* "nipy/labs/group/onesample.pyx":141 * * # Perform the loop * idx = simu*t.stride # <<<<<<<<<<<<<< @@ -1193,7 +1529,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ __pyx_v_idx = (__pyx_v_simu * __pyx_v_t->stride); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":142 + /* "nipy/labs/group/onesample.pyx":142 * # Perform the loop * idx = simu*t.stride * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1204,7 +1540,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel __pyx_t_4 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_4) break; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":143 + /* "nipy/labs/group/onesample.pyx":143 * idx = simu*t.stride * while(multi.index < multi.size): * fff_onesample_permute_signs(yp, y, magic) # <<<<<<<<<<<<<< @@ -1213,7 +1549,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fff_onesample_permute_signs(__pyx_v_yp, __pyx_v_y, __pyx_v_magic); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":144 + /* "nipy/labs/group/onesample.pyx":144 * while(multi.index < multi.size): * fff_onesample_permute_signs(yp, y, magic) * t.data[idx] = fff_onesample_stat_eval(stat, yp) # <<<<<<<<<<<<<< @@ -1222,7 +1558,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ (__pyx_v_t->data[__pyx_v_idx]) = fff_onesample_stat_eval(__pyx_v_stat, __pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":145 + /* "nipy/labs/group/onesample.pyx":145 * fff_onesample_permute_signs(yp, y, magic) * t.data[idx] = fff_onesample_stat_eval(stat, yp) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1233,7 +1569,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel } } - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":148 + /* "nipy/labs/group/onesample.pyx":148 * * # Free memory * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1242,7 +1578,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":149 + /* "nipy/labs/group/onesample.pyx":149 * # Free memory * fffpy_multi_iterator_delete(multi) * fff_vector_delete(yp) # <<<<<<<<<<<<<< @@ -1251,7 +1587,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fff_vector_delete(__pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":150 + /* "nipy/labs/group/onesample.pyx":150 * fffpy_multi_iterator_delete(multi) * fff_vector_delete(yp) * fff_vector_delete(magics) # <<<<<<<<<<<<<< @@ -1260,7 +1596,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fff_vector_delete(__pyx_v_magics); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":151 + /* "nipy/labs/group/onesample.pyx":151 * fff_vector_delete(yp) * fff_vector_delete(magics) * fff_onesample_stat_delete(stat) # <<<<<<<<<<<<<< @@ -1269,7 +1605,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel */ fff_onesample_stat_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":154 + /* "nipy/labs/group/onesample.pyx":154 * * # Return * return T # <<<<<<<<<<<<<< @@ -1286,32 +1622,22 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat(PyObject *__pyx_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("nipy.labs.group.onesample.stat"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("nipy.labs.group.onesample.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_T); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF(__pyx_v_id); - __Pyx_DECREF((PyObject *)__pyx_v_Magics); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_T); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":157 - * - * - * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, # <<<<<<<<<<<<<< - * int axis=0, ndarray Magics=None, unsigned int niter=5): - * """ - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_9onesample_stat_mfx[] = "\n T = stat_mfx(Y, V, id='student_mfx', base=0.0, axis=0, magics=None, niter=5).\n \n Compute a one-sample test statistic, with mixed-effect correction,\n over a number of deterministic or random permutations.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_3stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_9onesample_2stat_mfx[] = "\n T = stat_mfx(Y, V, id='student_mfx', base=0.0, axis=0, magics=None, niter=5).\n \n Compute a one-sample test statistic, with mixed-effect correction,\n over a number of deterministic or random permutations.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9onesample_3stat_mfx = {__Pyx_NAMESTR("stat_mfx"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9onesample_3stat_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_2stat_mfx)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_3stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_V = 0; PyObject *__pyx_v_id = 0; @@ -1319,99 +1645,88 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx int __pyx_v_axis; PyArrayObject *__pyx_v_Magics = 0; unsigned int __pyx_v_niter; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_v; - fff_vector *__pyx_v_t; - fff_vector *__pyx_v_magics; - fff_vector *__pyx_v_yp; - fff_onesample_stat_mfx *__pyx_v_stat; - fff_onesample_stat_flag __pyx_v_flag_stat; - int __pyx_v_n; - unsigned long __pyx_v_simu; - unsigned long __pyx_v_idx; - double __pyx_v_magic; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_nsimu; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_T; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - fff_onesample_stat_flag __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - unsigned long __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__id,&__pyx_n_s__base,&__pyx_n_s__axis,&__pyx_n_s__Magics,&__pyx_n_s__niter,0}; - __Pyx_RefNannySetupContext("stat_mfx"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stat_mfx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__id,&__pyx_n_s__base,&__pyx_n_s__axis,&__pyx_n_s__Magics,&__pyx_n_s__niter,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[2] = ((PyObject *)__pyx_n_s__student_mfx); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":158 + /* "nipy/labs/group/onesample.pyx":158 * * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, * int axis=0, ndarray Magics=None, unsigned int niter=5): # <<<<<<<<<<<<<< * """ * T = stat_mfx(Y, V, id='student_mfx', base=0.0, axis=0, magics=None, niter=5). */ - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[7] = {0,0,0,0,0,0,0}; - values[2] = ((PyObject *)__pyx_n_s__student_mfx); - values[5] = (PyObject*)((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); - if (unlikely(value)) { values[2] = value; kw_args--; } + values[5] = (PyObject *)((PyArrayObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); - if (unlikely(value)) { values[3] = value; kw_args--; } - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[4] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 2, 7, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[6] = value; kw_args--; } + } } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); - if (unlikely(value)) { values[5] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[6] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "stat_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_V = ((PyArrayObject *)values[1]); __pyx_v_id = values[2]; @@ -1419,7 +1734,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx __pyx_v_base = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":157 + /* "nipy/labs/group/onesample.pyx":157 * * * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, # <<<<<<<<<<<<<< @@ -1439,58 +1754,60 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx } else { __pyx_v_niter = ((unsigned int)5); } - } else { - __pyx_v_id = ((PyObject *)__pyx_n_s__student_mfx); - __pyx_v_base = ((double)0.0); - __pyx_v_axis = ((int)0); - - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":158 - * - * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, - * int axis=0, ndarray Magics=None, unsigned int niter=5): # <<<<<<<<<<<<<< - * """ - * T = stat_mfx(Y, V, id='student_mfx', base=0.0, axis=0, magics=None, niter=5). - */ - __pyx_v_Magics = ((PyArrayObject *)Py_None); - __pyx_v_niter = ((unsigned int)5); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: - __pyx_v_niter = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 6)); if (unlikely((__pyx_v_niter == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 6: - __pyx_v_Magics = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 5)); - case 5: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_base = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_V = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.onesample.stat_mfx"); + __Pyx_AddTraceback("nipy.labs.group.onesample.stat_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_V); - __Pyx_INCREF(__pyx_v_id); - __Pyx_INCREF((PyObject *)__pyx_v_Magics); - __pyx_v_nsimu = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_T = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V), __pyx_ptype_5numpy_ndarray, 1, "V", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Magics), __pyx_ptype_5numpy_ndarray, 1, "Magics", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_9onesample_2stat_mfx(__pyx_self, __pyx_v_Y, __pyx_v_V, __pyx_v_id, __pyx_v_base, __pyx_v_axis, __pyx_v_Magics, __pyx_v_niter); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_2stat_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, PyObject *__pyx_v_id, double __pyx_v_base, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics, unsigned int __pyx_v_niter) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_v; + fff_vector *__pyx_v_t; + fff_vector *__pyx_v_magics; + fff_vector *__pyx_v_yp; + fff_onesample_stat_mfx *__pyx_v_stat; + fff_onesample_stat_flag __pyx_v_flag_stat; + int __pyx_v_n; + unsigned long __pyx_v_simu; + unsigned long __pyx_v_idx; + double __pyx_v_magic; + fffpy_multi_iterator *__pyx_v_multi; + size_t __pyx_v_nsimu; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_T = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + fff_onesample_stat_flag __pyx_t_3; + int __pyx_t_4; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stat_mfx", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":167 + /* "nipy/labs/group/onesample.pyx":167 * cdef fff_vector *y, *v, *t, *magics, *yp * cdef fff_onesample_stat_mfx* stat * cdef fff_onesample_stat_flag flag_stat = stats[id] # <<<<<<<<<<<<<< @@ -1506,7 +1823,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_flag_stat = __pyx_t_3; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":174 + /* "nipy/labs/group/onesample.pyx":174 * * # Get number of observations * n = Y.shape[axis] # <<<<<<<<<<<<<< @@ -1515,20 +1832,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_n = ((int)(__pyx_v_Y->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":177 + /* "nipy/labs/group/onesample.pyx":177 * * # Read out magic numbers * if Magics == None: # <<<<<<<<<<<<<< * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":178 + /* "nipy/labs/group/onesample.pyx":178 * # Read out magic numbers * if Magics == None: * magics = fff_vector_new(1) # <<<<<<<<<<<<<< @@ -1537,19 +1853,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_magics = fff_vector_new(1); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":179 + /* "nipy/labs/group/onesample.pyx":179 * if Magics == None: * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure # <<<<<<<<<<<<<< * else: * magics = fff_vector_fromPyArray(Magics) */ - (__pyx_v_magics->data[0]) = 0; - goto __pyx_L6; + (__pyx_v_magics->data[0]) = 0.0; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":181 + /* "nipy/labs/group/onesample.pyx":181 * magics.data[0] = 0 ## Just to make sure * else: * magics = fff_vector_fromPyArray(Magics) # <<<<<<<<<<<<<< @@ -1558,22 +1874,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_magics = fff_vector_fromPyArray(__pyx_v_Magics); } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":184 + /* "nipy/labs/group/onesample.pyx":184 * * # Create output array * nsimu = magics.size # <<<<<<<<<<<<<< * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu */ - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_magics->size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_nsimu); - __pyx_v_nsimu = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_5 = __pyx_v_magics->size; + __pyx_v_nsimu = __pyx_t_5; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":185 + /* "nipy/labs/group/onesample.pyx":185 * # Create output array * nsimu = magics.size * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< @@ -1581,89 +1894,58 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx * T = np.zeros(dims) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = 0; __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); - } else { - __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else { - __pyx_t_1 = PyIter_Next(__pyx_t_6); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_7])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_Y->nd; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":186 + /* "nipy/labs/group/onesample.pyx":186 * nsimu = magics.size * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu # <<<<<<<<<<<<<< * T = np.zeros(dims) * */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_v_nsimu, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_nsimu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":187 + /* "nipy/labs/group/onesample.pyx":187 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = nsimu * T = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_T); - __pyx_v_T = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_T = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":190 + /* "nipy/labs/group/onesample.pyx":190 * * # Create local structure * stat = fff_onesample_stat_mfx_new(n, flag_stat, base) # <<<<<<<<<<<<<< @@ -1672,7 +1954,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_stat = fff_onesample_stat_mfx_new(__pyx_v_n, __pyx_v_flag_stat, __pyx_v_base); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":191 + /* "nipy/labs/group/onesample.pyx":191 * # Create local structure * stat = fff_onesample_stat_mfx_new(n, flag_stat, base) * stat.niter = niter # <<<<<<<<<<<<<< @@ -1681,7 +1963,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_stat->niter = __pyx_v_niter; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":192 + /* "nipy/labs/group/onesample.pyx":192 * stat = fff_onesample_stat_mfx_new(n, flag_stat, base) * stat.niter = niter * yp = fff_vector_new(n) # <<<<<<<<<<<<<< @@ -1690,7 +1972,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_yp = fff_vector_new(__pyx_v_n); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":195 + /* "nipy/labs/group/onesample.pyx":195 * * # Multi-iterator * multi = fffpy_multi_iterator_new(3, axis, Y, V, T) # <<<<<<<<<<<<<< @@ -1699,7 +1981,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_multi = fffpy_multi_iterator_new(3, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_V), ((void *)__pyx_v_T)); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":198 + /* "nipy/labs/group/onesample.pyx":198 * * # Vector views * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -1708,7 +1990,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":199 + /* "nipy/labs/group/onesample.pyx":199 * # Vector views * y = multi.vector[0] * v = multi.vector[1] # <<<<<<<<<<<<<< @@ -1717,7 +1999,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_v = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":200 + /* "nipy/labs/group/onesample.pyx":200 * y = multi.vector[0] * v = multi.vector[1] * t = multi.vector[2] # <<<<<<<<<<<<<< @@ -1726,17 +2008,17 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_t = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":203 + /* "nipy/labs/group/onesample.pyx":203 * * # Loop * for simu from 0 <= simu < nsimu: # <<<<<<<<<<<<<< * * # Set the magic number */ - __pyx_t_9 = __Pyx_PyInt_AsUnsignedLong(__pyx_v_nsimu); if (unlikely((__pyx_t_9 == (unsigned long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_simu = 0; __pyx_v_simu < __pyx_t_9; __pyx_v_simu++) { + __pyx_t_5 = __pyx_v_nsimu; + for (__pyx_v_simu = 0; __pyx_v_simu < __pyx_t_5; __pyx_v_simu++) { - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":206 + /* "nipy/labs/group/onesample.pyx":206 * * # Set the magic number * magic = magics.data[simu*magics.stride] # <<<<<<<<<<<<<< @@ -1745,7 +2027,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_magic = (__pyx_v_magics->data[(__pyx_v_simu * __pyx_v_magics->stride)]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":209 + /* "nipy/labs/group/onesample.pyx":209 * * # Reset the multi-iterator * fffpy_multi_iterator_reset(multi) # <<<<<<<<<<<<<< @@ -1754,7 +2036,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fffpy_multi_iterator_reset(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":212 + /* "nipy/labs/group/onesample.pyx":212 * * # Perform the loop * idx = simu*t.stride # <<<<<<<<<<<<<< @@ -1763,7 +2045,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ __pyx_v_idx = (__pyx_v_simu * __pyx_v_t->stride); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":213 + /* "nipy/labs/group/onesample.pyx":213 * # Perform the loop * idx = simu*t.stride * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1774,7 +2056,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx __pyx_t_4 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_4) break; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":214 + /* "nipy/labs/group/onesample.pyx":214 * idx = simu*t.stride * while(multi.index < multi.size): * fff_onesample_permute_signs(yp, y, magic) # <<<<<<<<<<<<<< @@ -1783,7 +2065,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fff_onesample_permute_signs(__pyx_v_yp, __pyx_v_y, __pyx_v_magic); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":215 + /* "nipy/labs/group/onesample.pyx":215 * while(multi.index < multi.size): * fff_onesample_permute_signs(yp, y, magic) * t.data[idx] = fff_onesample_stat_mfx_eval(stat, yp, v) # <<<<<<<<<<<<<< @@ -1792,7 +2074,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ (__pyx_v_t->data[__pyx_v_idx]) = fff_onesample_stat_mfx_eval(__pyx_v_stat, __pyx_v_yp, __pyx_v_v); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":216 + /* "nipy/labs/group/onesample.pyx":216 * fff_onesample_permute_signs(yp, y, magic) * t.data[idx] = fff_onesample_stat_mfx_eval(stat, yp, v) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1803,7 +2085,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx } } - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":220 + /* "nipy/labs/group/onesample.pyx":220 * * # Free memory * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1812,7 +2094,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":221 + /* "nipy/labs/group/onesample.pyx":221 * # Free memory * fffpy_multi_iterator_delete(multi) * fff_vector_delete(yp) # <<<<<<<<<<<<<< @@ -1821,7 +2103,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fff_vector_delete(__pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":222 + /* "nipy/labs/group/onesample.pyx":222 * fffpy_multi_iterator_delete(multi) * fff_vector_delete(yp) * fff_vector_delete(magics) # <<<<<<<<<<<<<< @@ -1830,7 +2112,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fff_vector_delete(__pyx_v_magics); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":223 + /* "nipy/labs/group/onesample.pyx":223 * fff_vector_delete(yp) * fff_vector_delete(magics) * fff_onesample_stat_mfx_delete(stat) # <<<<<<<<<<<<<< @@ -1839,7 +2121,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx */ fff_onesample_stat_mfx_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":226 + /* "nipy/labs/group/onesample.pyx":226 * * # Return * return T # <<<<<<<<<<<<<< @@ -1856,110 +2138,93 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx(PyObject *__pyx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("nipy.labs.group.onesample.stat_mfx"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("nipy.labs.group.onesample.stat_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_nsimu); - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_T); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_V); - __Pyx_DECREF(__pyx_v_id); - __Pyx_DECREF((PyObject *)__pyx_v_Magics); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_T); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":230 - * - * - * def pdf_fit_mfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< - * """ - * (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_9onesample_pdf_fit_mfx[] = "\n (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0).\n \n Comments to follow.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_5pdf_fit_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_9onesample_4pdf_fit_mfx[] = "\n (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0).\n \n Comments to follow.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9onesample_5pdf_fit_mfx = {__Pyx_NAMESTR("pdf_fit_mfx"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9onesample_5pdf_fit_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_4pdf_fit_mfx)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_5pdf_fit_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_V = 0; int __pyx_v_axis; int __pyx_v_niter; int __pyx_v_constraint; double __pyx_v_base; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_v; - fff_vector *__pyx_v_w; - fff_vector *__pyx_v_z; - fff_onesample_stat_mfx *__pyx_v_stat; - fffpy_multi_iterator *__pyx_v_multi; - int __pyx_v_n; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_W; - PyObject *__pyx_v_Z; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__axis,&__pyx_n_s__niter,&__pyx_n_s__constraint,&__pyx_n_s__base,0}; - __Pyx_RefNannySetupContext("pdf_fit_mfx"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pdf_fit_mfx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__axis,&__pyx_n_s__niter,&__pyx_n_s__constraint,&__pyx_n_s__base,0}; PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pdf_fit_mfx", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[2] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[3] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("pdf_fit_mfx", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__constraint); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__constraint); - if (unlikely(value)) { values[4] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdf_fit_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); - if (unlikely(value)) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pdf_fit_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_V = ((PyArrayObject *)values[1]); if (values[2]) { @@ -1980,55 +2245,71 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ if (values[5]) { __pyx_v_base = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "nipy/labs/group/onesample.pyx":230 + * + * + * def pdf_fit_mfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ __pyx_v_base = ((double)0.0); } - } else { - __pyx_v_axis = ((int)0); - __pyx_v_niter = ((int)5); - __pyx_v_constraint = ((int)0); - __pyx_v_base = ((double)0.0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_base = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_constraint = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_constraint == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_niter = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_niter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_V = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("pdf_fit_mfx", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_mfx"); + __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_V); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_W = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_Z = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V), __pyx_ptype_5numpy_ndarray, 1, "V", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":239 - * cdef fff_onesample_stat_mfx* stat - * cdef fffpy_multi_iterator* multi - * cdef int n = Y.shape[axis] # <<<<<<<<<<<<<< - * - * # Create output array + __pyx_r = __pyx_pf_4nipy_4labs_5group_9onesample_4pdf_fit_mfx(__pyx_self, __pyx_v_Y, __pyx_v_V, __pyx_v_axis, __pyx_v_niter, __pyx_v_constraint, __pyx_v_base); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_4pdf_fit_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, int __pyx_v_axis, int __pyx_v_niter, int __pyx_v_constraint, double __pyx_v_base) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_v; + fff_vector *__pyx_v_w; + fff_vector *__pyx_v_z; + fff_onesample_stat_mfx *__pyx_v_stat; + fffpy_multi_iterator *__pyx_v_multi; + int __pyx_v_n; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_W = NULL; + PyObject *__pyx_v_Z = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pdf_fit_mfx", 0); + + /* "nipy/labs/group/onesample.pyx":239 + * cdef fff_onesample_stat_mfx* stat + * cdef fffpy_multi_iterator* multi + * cdef int n = Y.shape[axis] # <<<<<<<<<<<<<< + * + * # Create output array */ __pyx_v_n = (__pyx_v_Y->dimensions[__pyx_v_axis]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":242 + /* "nipy/labs/group/onesample.pyx":242 * * # Create output array * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< @@ -2036,105 +2317,70 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ * Z = np.zeros(dims) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_v_i); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_Y->nd; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_5])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); + __pyx_t_4 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":243 + /* "nipy/labs/group/onesample.pyx":243 * # Create output array * dims = [Y.shape[i] for i in range(Y.ndim)] * W = np.zeros(dims) # <<<<<<<<<<<<<< * Z = np.zeros(dims) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_W); - __pyx_v_W = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_W = __pyx_t_5; + __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":244 + /* "nipy/labs/group/onesample.pyx":244 * dims = [Y.shape[i] for i in range(Y.ndim)] * W = np.zeros(dims) * Z = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_Z); - __pyx_v_Z = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_Z = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":247 + /* "nipy/labs/group/onesample.pyx":247 * * # Create local structure * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, base) # <<<<<<<<<<<<<< @@ -2143,7 +2389,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_stat = fff_onesample_stat_mfx_new(__pyx_v_n, FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, __pyx_v_base); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":248 + /* "nipy/labs/group/onesample.pyx":248 * # Create local structure * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, base) * stat.niter = niter # <<<<<<<<<<<<<< @@ -2152,7 +2398,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_stat->niter = __pyx_v_niter; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":249 + /* "nipy/labs/group/onesample.pyx":249 * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, base) * stat.niter = niter * stat.constraint = constraint # <<<<<<<<<<<<<< @@ -2161,7 +2407,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_stat->constraint = __pyx_v_constraint; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":252 + /* "nipy/labs/group/onesample.pyx":252 * * # Multi-iterator * multi = fffpy_multi_iterator_new(4, axis, Y, V, W, Z) # <<<<<<<<<<<<<< @@ -2170,7 +2416,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_multi = fffpy_multi_iterator_new(4, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_V), ((void *)__pyx_v_W), ((void *)__pyx_v_Z)); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":255 + /* "nipy/labs/group/onesample.pyx":255 * * # Create views on nd-arrays * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -2179,7 +2425,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":256 + /* "nipy/labs/group/onesample.pyx":256 * # Create views on nd-arrays * y = multi.vector[0] * v = multi.vector[1] # <<<<<<<<<<<<<< @@ -2188,7 +2434,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_v = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":257 + /* "nipy/labs/group/onesample.pyx":257 * y = multi.vector[0] * v = multi.vector[1] * w = multi.vector[2] # <<<<<<<<<<<<<< @@ -2197,7 +2443,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_w = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":258 + /* "nipy/labs/group/onesample.pyx":258 * v = multi.vector[1] * w = multi.vector[2] * z = multi.vector[3] # <<<<<<<<<<<<<< @@ -2206,7 +2452,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ __pyx_v_z = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":261 + /* "nipy/labs/group/onesample.pyx":261 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -2214,10 +2460,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ * fffpy_multi_iterator_update(multi) */ while (1) { - __pyx_t_7 = (__pyx_v_multi->index < __pyx_v_multi->size); - if (!__pyx_t_7) break; + __pyx_t_6 = (__pyx_v_multi->index < __pyx_v_multi->size); + if (!__pyx_t_6) break; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":262 + /* "nipy/labs/group/onesample.pyx":262 * # Loop * while(multi.index < multi.size): * fff_onesample_stat_mfx_pdf_fit(w, z, stat, y, v) # <<<<<<<<<<<<<< @@ -2226,7 +2472,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ fff_onesample_stat_mfx_pdf_fit(__pyx_v_w, __pyx_v_z, __pyx_v_stat, __pyx_v_y, __pyx_v_v); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":263 + /* "nipy/labs/group/onesample.pyx":263 * while(multi.index < multi.size): * fff_onesample_stat_mfx_pdf_fit(w, z, stat, y, v) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -2236,7 +2482,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":267 + /* "nipy/labs/group/onesample.pyx":267 * * # Delete local structures * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -2245,7 +2491,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":268 + /* "nipy/labs/group/onesample.pyx":268 * # Delete local structures * fffpy_multi_iterator_delete(multi) * fff_onesample_stat_mfx_delete(stat) # <<<<<<<<<<<<<< @@ -2254,7 +2500,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ */ fff_onesample_stat_mfx_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":271 + /* "nipy/labs/group/onesample.pyx":271 * * # Return * return W, Z # <<<<<<<<<<<<<< @@ -2262,125 +2508,111 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx(PyObject *__ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_W); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_W); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_W); __Pyx_GIVEREF(__pyx_v_W); __Pyx_INCREF(__pyx_v_Z); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_Z); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_Z); __Pyx_GIVEREF(__pyx_v_Z); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_mfx"); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_W); - __Pyx_DECREF(__pyx_v_Z); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_V); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_W); + __Pyx_XDECREF(__pyx_v_Z); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":274 - * - * - * def pdf_fit_gmfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< - * """ - * (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_9onesample_pdf_fit_gmfx[] = "\n (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0).\n \n Comments to follow.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_7pdf_fit_gmfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_9onesample_6pdf_fit_gmfx[] = "\n (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0).\n \n Comments to follow.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9onesample_7pdf_fit_gmfx = {__Pyx_NAMESTR("pdf_fit_gmfx"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9onesample_7pdf_fit_gmfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_6pdf_fit_gmfx)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9onesample_7pdf_fit_gmfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y = 0; PyArrayObject *__pyx_v_V = 0; int __pyx_v_axis; int __pyx_v_niter; int __pyx_v_constraint; double __pyx_v_base; - fff_vector *__pyx_v_y; - fff_vector *__pyx_v_v; - fff_vector *__pyx_v_mu; - fff_vector *__pyx_v_s2; - fff_onesample_stat_mfx *__pyx_v_stat; - fffpy_multi_iterator *__pyx_v_multi; - int __pyx_v_n; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_MU; - PyObject *__pyx_v_S2; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - Py_ssize_t __pyx_t_5; - int __pyx_t_6; - int __pyx_t_7; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__axis,&__pyx_n_s__niter,&__pyx_n_s__constraint,&__pyx_n_s__base,0}; - __Pyx_RefNannySetupContext("pdf_fit_gmfx"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("pdf_fit_gmfx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y,&__pyx_n_s__V,&__pyx_n_s__axis,&__pyx_n_s__niter,&__pyx_n_s__constraint,&__pyx_n_s__base,0}; PyObject* values[6] = {0,0,0,0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("pdf_fit_gmfx", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[2] = value; kw_args--; } + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[3] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("pdf_fit_gmfx", 0, 2, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__constraint); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); + if (value) { values[5] = value; kw_args--; } + } } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__constraint); - if (unlikely(value)) { values[4] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "pdf_fit_gmfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__base); - if (unlikely(value)) { values[5] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "pdf_fit_gmfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y = ((PyArrayObject *)values[0]); __pyx_v_V = ((PyArrayObject *)values[1]); if (values[2]) { @@ -2401,46 +2633,62 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ if (values[5]) { __pyx_v_base = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "nipy/labs/group/onesample.pyx":274 + * + * + * def pdf_fit_gmfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ __pyx_v_base = ((double)0.0); } - } else { - __pyx_v_axis = ((int)0); - __pyx_v_niter = ((int)5); - __pyx_v_constraint = ((int)0); - __pyx_v_base = ((double)0.0); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: - __pyx_v_base = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_base == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_constraint = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_constraint == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: - __pyx_v_niter = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_niter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: - __pyx_v_V = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("pdf_fit_gmfx", 0, 2, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_gmfx"); + __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_gmfx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y); - __Pyx_INCREF((PyObject *)__pyx_v_V); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_MU = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_S2 = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y), __pyx_ptype_5numpy_ndarray, 1, "Y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V), __pyx_ptype_5numpy_ndarray, 1, "V", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_9onesample_6pdf_fit_gmfx(__pyx_self, __pyx_v_Y, __pyx_v_V, __pyx_v_axis, __pyx_v_niter, __pyx_v_constraint, __pyx_v_base); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_6pdf_fit_gmfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y, PyArrayObject *__pyx_v_V, int __pyx_v_axis, int __pyx_v_niter, int __pyx_v_constraint, double __pyx_v_base) { + fff_vector *__pyx_v_y; + fff_vector *__pyx_v_v; + fff_vector *__pyx_v_mu; + fff_vector *__pyx_v_s2; + fff_onesample_stat_mfx *__pyx_v_stat; + fffpy_multi_iterator *__pyx_v_multi; + int __pyx_v_n; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_MU = NULL; + PyObject *__pyx_v_S2 = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("pdf_fit_gmfx", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":283 + /* "nipy/labs/group/onesample.pyx":283 * cdef fff_onesample_stat_mfx* stat * cdef fffpy_multi_iterator* multi * cdef int n = Y.shape[axis] # <<<<<<<<<<<<<< @@ -2449,7 +2697,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_n = (__pyx_v_Y->dimensions[__pyx_v_axis]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":286 + /* "nipy/labs/group/onesample.pyx":286 * * # Create output array * dims = [Y.shape[i] for i in range(Y.ndim)] # <<<<<<<<<<<<<< @@ -2457,114 +2705,79 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ * MU = np.zeros(dims) */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_Y->nd); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { - __pyx_t_2 = 0; __pyx_t_4 = __pyx_t_3; __Pyx_INCREF(__pyx_t_4); - } else { - __pyx_t_2 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; - } else { - __pyx_t_3 = PyIter_Next(__pyx_t_4); - if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_3); - } - __Pyx_DECREF(__pyx_v_i); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_Y->nd; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_5 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y->dimensions[__pyx_t_5])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_3); if (unlikely(__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__Pyx_PyList_Append(__pyx_t_1, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_1); + __pyx_t_4 = ((PyObject *)__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_4); + __pyx_t_4 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":287 + /* "nipy/labs/group/onesample.pyx":287 * # Create output array * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 # <<<<<<<<<<<<<< * MU = np.zeros(dims) * S2 = np.zeros(dims) */ - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_int_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":288 + /* "nipy/labs/group/onesample.pyx":288 * dims = [Y.shape[i] for i in range(Y.ndim)] * dims[axis] = 1 * MU = np.zeros(dims) # <<<<<<<<<<<<<< * S2 = np.zeros(dims) * */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_MU); - __pyx_v_MU = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_v_MU = __pyx_t_5; + __pyx_t_5 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":289 + /* "nipy/labs/group/onesample.pyx":289 * dims[axis] = 1 * MU = np.zeros(dims) * S2 = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_S2); - __pyx_v_S2 = __pyx_t_4; - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_S2 = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":292 + /* "nipy/labs/group/onesample.pyx":292 * * # Create local structure * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_STUDENT_MFX, base) # <<<<<<<<<<<<<< @@ -2573,7 +2786,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_stat = fff_onesample_stat_mfx_new(__pyx_v_n, FFF_ONESAMPLE_STUDENT_MFX, __pyx_v_base); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":293 + /* "nipy/labs/group/onesample.pyx":293 * # Create local structure * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_STUDENT_MFX, base) * stat.niter = niter # <<<<<<<<<<<<<< @@ -2582,7 +2795,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_stat->niter = __pyx_v_niter; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":294 + /* "nipy/labs/group/onesample.pyx":294 * stat = fff_onesample_stat_mfx_new(n, FFF_ONESAMPLE_STUDENT_MFX, base) * stat.niter = niter * stat.constraint = constraint # <<<<<<<<<<<<<< @@ -2591,7 +2804,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_stat->constraint = __pyx_v_constraint; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":297 + /* "nipy/labs/group/onesample.pyx":297 * * # Multi-iterator * multi = fffpy_multi_iterator_new(4, axis, Y, V, MU, S2) # <<<<<<<<<<<<<< @@ -2600,7 +2813,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_multi = fffpy_multi_iterator_new(4, __pyx_v_axis, ((void *)__pyx_v_Y), ((void *)__pyx_v_V), ((void *)__pyx_v_MU), ((void *)__pyx_v_S2)); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":300 + /* "nipy/labs/group/onesample.pyx":300 * * # Create views on nd-arrays * y = multi.vector[0] # <<<<<<<<<<<<<< @@ -2609,7 +2822,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_y = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":301 + /* "nipy/labs/group/onesample.pyx":301 * # Create views on nd-arrays * y = multi.vector[0] * v = multi.vector[1] # <<<<<<<<<<<<<< @@ -2618,7 +2831,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_v = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":302 + /* "nipy/labs/group/onesample.pyx":302 * y = multi.vector[0] * v = multi.vector[1] * mu = multi.vector[2] # <<<<<<<<<<<<<< @@ -2627,7 +2840,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_mu = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":303 + /* "nipy/labs/group/onesample.pyx":303 * v = multi.vector[1] * mu = multi.vector[2] * s2 = multi.vector[3] # <<<<<<<<<<<<<< @@ -2636,7 +2849,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ __pyx_v_s2 = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":306 + /* "nipy/labs/group/onesample.pyx":306 * * # Loop * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -2644,10 +2857,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ * fffpy_multi_iterator_update(multi) */ while (1) { - __pyx_t_7 = (__pyx_v_multi->index < __pyx_v_multi->size); - if (!__pyx_t_7) break; + __pyx_t_6 = (__pyx_v_multi->index < __pyx_v_multi->size); + if (!__pyx_t_6) break; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":307 + /* "nipy/labs/group/onesample.pyx":307 * # Loop * while(multi.index < multi.size): * fff_onesample_stat_gmfx_pdf_fit(mu.data, s2.data, stat, y, v) # <<<<<<<<<<<<<< @@ -2656,7 +2869,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ fff_onesample_stat_gmfx_pdf_fit(__pyx_v_mu->data, __pyx_v_s2->data, __pyx_v_stat, __pyx_v_y, __pyx_v_v); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":308 + /* "nipy/labs/group/onesample.pyx":308 * while(multi.index < multi.size): * fff_onesample_stat_gmfx_pdf_fit(mu.data, s2.data, stat, y, v) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -2666,7 +2879,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ fffpy_multi_iterator_update(__pyx_v_multi); } - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":312 + /* "nipy/labs/group/onesample.pyx":312 * * # Delete local structures * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -2675,7 +2888,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":313 + /* "nipy/labs/group/onesample.pyx":313 * # Delete local structures * fffpy_multi_iterator_delete(multi) * fff_onesample_stat_mfx_delete(stat) # <<<<<<<<<<<<<< @@ -2684,7 +2897,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ */ fff_onesample_stat_mfx_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":316 + /* "nipy/labs/group/onesample.pyx":316 * * # Return * return MU, S2 # <<<<<<<<<<<<<< @@ -2692,39 +2905,47 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_MU); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_MU); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_MU); __Pyx_GIVEREF(__pyx_v_MU); __Pyx_INCREF(__pyx_v_S2); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_v_S2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_S2); __Pyx_GIVEREF(__pyx_v_S2); - __pyx_r = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_gmfx"); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("nipy.labs.group.onesample.pdf_fit_gmfx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_MU); - __Pyx_DECREF(__pyx_v_S2); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y); - __Pyx_DECREF((PyObject *)__pyx_v_V); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_MU); + __Pyx_XDECREF(__pyx_v_S2); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -2732,8 +2953,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx(PyObject *_ * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -2745,23 +2965,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -2769,7 +3008,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2778,16 +3017,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2797,7 +3036,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2805,11 +3044,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2818,9 +3057,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2830,43 +3069,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2876,142 +3109,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3020,25 +3246,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3047,17 +3273,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3066,7 +3294,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3082,7 +3310,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3094,49 +3322,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -3147,50 +3376,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -3199,10 +3422,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3212,10 +3435,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3225,10 +3448,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3238,10 +3461,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3251,10 +3474,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3264,10 +3487,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3277,10 +3500,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3290,10 +3513,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3303,10 +3526,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3316,10 +3539,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3329,10 +3552,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3342,10 +3565,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3355,10 +3578,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3368,10 +3591,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3381,10 +3604,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3394,10 +3617,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -3407,37 +3630,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -3446,7 +3669,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -3455,105 +3678,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -3561,11 +3793,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3575,7 +3807,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -3583,15 +3815,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -3601,10 +3832,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -3612,7 +3847,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3622,7 +3857,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3630,7 +3865,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3640,10 +3875,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3651,7 +3890,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3661,7 +3900,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3669,7 +3908,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3679,10 +3918,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3690,7 +3933,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3700,7 +3943,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3708,7 +3951,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3718,10 +3961,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3729,7 +3976,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3739,7 +3986,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3747,7 +3994,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3757,10 +4004,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3768,7 +4019,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3778,7 +4029,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3786,7 +4037,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -3795,33 +4046,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3830,7 +4081,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3839,167 +4090,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - } - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 - * child, new_offset = fields + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4007,16 +4285,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4025,469 +4302,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4500,24 +4756,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4527,12 +4782,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -4542,7 +4796,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -4554,7 +4808,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -4563,7 +4817,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -4574,7 +4828,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -4583,7 +4837,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -4592,12 +4846,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -4607,11 +4859,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4621,7 +4873,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4636,7 +4888,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4650,27 +4902,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9onesample_stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_stat)}, - {__Pyx_NAMESTR("stat_mfx"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9onesample_stat_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_stat_mfx)}, - {__Pyx_NAMESTR("pdf_fit_mfx"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_pdf_fit_mfx)}, - {__Pyx_NAMESTR("pdf_fit_gmfx"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9onesample_pdf_fit_gmfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9onesample_pdf_fit_gmfx)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("onesample"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -4682,72 +4927,460 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_n_s__MU, __pyx_k__MU, sizeof(__pyx_k__MU), 0, 0, 1, 1}, {&__pyx_n_s__Magics, __pyx_k__Magics, sizeof(__pyx_k__Magics), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__S2, __pyx_k__S2, sizeof(__pyx_k__S2), 0, 0, 1, 1}, + {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__V, __pyx_k__V, sizeof(__pyx_k__V), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__W, __pyx_k__W, sizeof(__pyx_k__W), 0, 0, 1, 1}, {&__pyx_n_s__Y, __pyx_k__Y, sizeof(__pyx_k__Y), 0, 0, 1, 1}, + {&__pyx_n_s__Z, __pyx_k__Z, sizeof(__pyx_k__Z), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__constraint, __pyx_k__constraint, sizeof(__pyx_k__constraint), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, {&__pyx_n_s__elr, __pyx_k__elr, sizeof(__pyx_k__elr), 0, 0, 1, 1}, {&__pyx_n_s__elr_mfx, __pyx_k__elr_mfx, sizeof(__pyx_k__elr_mfx), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__flag_stat, __pyx_k__flag_stat, sizeof(__pyx_k__flag_stat), 0, 0, 1, 1}, {&__pyx_n_s__grubb, __pyx_k__grubb, sizeof(__pyx_k__grubb), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, - {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, {&__pyx_n_s__laplace, __pyx_k__laplace, sizeof(__pyx_k__laplace), 0, 0, 1, 1}, + {&__pyx_n_s__magic, __pyx_k__magic, sizeof(__pyx_k__magic), 0, 0, 1, 1}, + {&__pyx_n_s__magics, __pyx_k__magics, sizeof(__pyx_k__magics), 0, 0, 1, 1}, {&__pyx_n_s__mean, __pyx_k__mean, sizeof(__pyx_k__mean), 0, 0, 1, 1}, {&__pyx_n_s__mean_gauss_mfx, __pyx_k__mean_gauss_mfx, sizeof(__pyx_k__mean_gauss_mfx), 0, 0, 1, 1}, {&__pyx_n_s__mean_mfx, __pyx_k__mean_mfx, sizeof(__pyx_k__mean_mfx), 0, 0, 1, 1}, {&__pyx_n_s__median, __pyx_k__median, sizeof(__pyx_k__median), 0, 0, 1, 1}, {&__pyx_n_s__median_mfx, __pyx_k__median_mfx, sizeof(__pyx_k__median_mfx), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__mu, __pyx_k__mu, sizeof(__pyx_k__mu), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, {&__pyx_n_s__niter, __pyx_k__niter, sizeof(__pyx_k__niter), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__nsimu, __pyx_k__nsimu, sizeof(__pyx_k__nsimu), 0, 0, 1, 1}, + {&__pyx_n_s__nsimu_max, __pyx_k__nsimu_max, sizeof(__pyx_k__nsimu_max), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__pdf_fit_gmfx, __pyx_k__pdf_fit_gmfx, sizeof(__pyx_k__pdf_fit_gmfx), 0, 0, 1, 1}, + {&__pyx_n_s__pdf_fit_mfx, __pyx_k__pdf_fit_mfx, sizeof(__pyx_k__pdf_fit_mfx), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, {&__pyx_n_s__sign, __pyx_k__sign, sizeof(__pyx_k__sign), 0, 0, 1, 1}, {&__pyx_n_s__sign_mfx, __pyx_k__sign_mfx, sizeof(__pyx_k__sign_mfx), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__simu, __pyx_k__simu, sizeof(__pyx_k__simu), 0, 0, 1, 1}, + {&__pyx_n_s__stat, __pyx_k__stat, sizeof(__pyx_k__stat), 0, 0, 1, 1}, + {&__pyx_n_s__stat_mfx, __pyx_k__stat_mfx, sizeof(__pyx_k__stat_mfx), 0, 0, 1, 1}, {&__pyx_n_s__stats, __pyx_k__stats, sizeof(__pyx_k__stats), 0, 0, 1, 1}, - {&__pyx_n_s__stride, __pyx_k__stride, sizeof(__pyx_k__stride), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, {&__pyx_n_s__student, __pyx_k__student, sizeof(__pyx_k__student), 0, 0, 1, 1}, {&__pyx_n_s__student_mfx, __pyx_k__student_mfx, sizeof(__pyx_k__student_mfx), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, {&__pyx_n_s__tukey, __pyx_k__tukey, sizeof(__pyx_k__tukey), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__vector, __pyx_k__vector, sizeof(__pyx_k__vector), 0, 0, 1, 1}, + {&__pyx_n_s__v, __pyx_k__v, sizeof(__pyx_k__v), 0, 0, 1, 1}, + {&__pyx_n_s__w, __pyx_k__w, sizeof(__pyx_k__w), 0, 0, 1, 1}, {&__pyx_n_s__wilcoxon, __pyx_k__wilcoxon, sizeof(__pyx_k__wilcoxon), 0, 0, 1, 1}, {&__pyx_n_s__wilcoxon_mfx, __pyx_k__wilcoxon_mfx, sizeof(__pyx_k__wilcoxon_mfx), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__yp, __pyx_k__yp, sizeof(__pyx_k__yp), 0, 0, 1, 1}, + {&__pyx_n_s__z, __pyx_k__z, sizeof(__pyx_k__z), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/group/onesample.pyx":88 + * + * # Test stat without mixed-effect correction + * def stat(ndarray Y, id='student', double base=0.0, # <<<<<<<<<<<<<< + * int axis=0, ndarray Magics=None): + * """ + */ + __pyx_k_tuple_15 = PyTuple_New(20); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__id)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__base)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__base)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__base)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__Magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 6, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 7, ((PyObject *)__pyx_n_s__magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__yp)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 8, ((PyObject *)__pyx_n_s__yp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 9, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag_stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 10, ((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 11, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__simu)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 12, ((PyObject *)__pyx_n_s__simu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__simu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nsimu)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 13, ((PyObject *)__pyx_n_s__nsimu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsimu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 14, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magic)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 15, ((PyObject *)__pyx_n_s__magic)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magic)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 16, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 17, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 18, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 19, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(5, 0, 20, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__stat, 88, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/onesample.pyx":157 + * + * + * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, # <<<<<<<<<<<<<< + * int axis=0, ndarray Magics=None, unsigned int niter=5): + * """ + */ + __pyx_k_tuple_19 = PyTuple_New(24); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__V)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__V)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__V)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__id)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__base)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__base)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__base)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__Magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__yp)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__yp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag_stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nsimu_max)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__nsimu_max)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsimu_max)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__simu)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__simu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__simu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 17, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magic)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 18, ((PyObject *)__pyx_n_s__magic)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magic)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 19, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nsimu)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 20, ((PyObject *)__pyx_n_s__nsimu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsimu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 21, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 22, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 23, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(7, 0, 24, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__stat_mfx, 157, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/onesample.pyx":230 + * + * + * def pdf_fit_mfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ + __pyx_k_tuple_21 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__V)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__V)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__V)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__constraint)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__constraint)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__constraint)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__base)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 5, ((PyObject *)__pyx_n_s__base)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__base)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 6, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 7, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__w)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 8, ((PyObject *)__pyx_n_s__w)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__w)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__z)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 9, ((PyObject *)__pyx_n_s__z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 10, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 11, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 12, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 13, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__W)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 14, ((PyObject *)__pyx_n_s__W)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__W)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Z)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 15, ((PyObject *)__pyx_n_s__Z)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Z)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 16, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__pdf_fit_mfx, 230, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/onesample.pyx":274 + * + * + * def pdf_fit_gmfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ + __pyx_k_tuple_23 = PyTuple_New(17); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_n_s__Y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__V)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 1, ((PyObject *)__pyx_n_s__V)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__V)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 2, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 3, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__constraint)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 4, ((PyObject *)__pyx_n_s__constraint)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__constraint)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__base)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 5, ((PyObject *)__pyx_n_s__base)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__base)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 6, ((PyObject *)__pyx_n_s__y)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 7, ((PyObject *)__pyx_n_s__v)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mu)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 8, ((PyObject *)__pyx_n_s__mu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__s2)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 9, ((PyObject *)__pyx_n_s__s2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__s2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 10, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 11, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 12, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 13, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__MU)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 14, ((PyObject *)__pyx_n_s__MU)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__MU)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__S2)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 15, ((PyObject *)__pyx_n_s__S2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__S2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 16, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + __pyx_k_codeobj_24 = (PyObject*)__Pyx_PyCode_New(6, 0, 17, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__pdf_fit_gmfx, 274, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -4770,8 +5403,8 @@ PyMODINIT_FUNC PyInit_onesample(void) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -4779,14 +5412,19 @@ PyMODINIT_FUNC PyInit_onesample(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_onesample(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_onesample(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -4797,16 +5435,23 @@ PyMODINIT_FUNC PyInit_onesample(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("onesample"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("onesample"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.group.onesample")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.group.onesample", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4815,28 +5460,39 @@ PyMODINIT_FUNC PyInit_onesample(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":10 + /* "nipy/labs/group/onesample.pyx":10 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":63 + /* "nipy/labs/group/onesample.pyx":63 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -4845,7 +5501,7 @@ PyMODINIT_FUNC PyInit_onesample(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":64 + /* "nipy/labs/group/onesample.pyx":64 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -4854,19 +5510,19 @@ PyMODINIT_FUNC PyInit_onesample(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":65 + /* "nipy/labs/group/onesample.pyx":65 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":69 + /* "nipy/labs/group/onesample.pyx":69 * * # Stat dictionary * stats = {'mean': FFF_ONESAMPLE_EMPIRICAL_MEAN, # <<<<<<<<<<<<<< @@ -4880,7 +5536,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mean), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":70 + /* "nipy/labs/group/onesample.pyx":70 * # Stat dictionary * stats = {'mean': FFF_ONESAMPLE_EMPIRICAL_MEAN, * 'median': FFF_ONESAMPLE_EMPIRICAL_MEDIAN, # <<<<<<<<<<<<<< @@ -4892,7 +5548,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__median), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":71 + /* "nipy/labs/group/onesample.pyx":71 * stats = {'mean': FFF_ONESAMPLE_EMPIRICAL_MEAN, * 'median': FFF_ONESAMPLE_EMPIRICAL_MEDIAN, * 'student': FFF_ONESAMPLE_STUDENT, # <<<<<<<<<<<<<< @@ -4904,7 +5560,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__student), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":72 + /* "nipy/labs/group/onesample.pyx":72 * 'median': FFF_ONESAMPLE_EMPIRICAL_MEDIAN, * 'student': FFF_ONESAMPLE_STUDENT, * 'laplace': FFF_ONESAMPLE_LAPLACE, # <<<<<<<<<<<<<< @@ -4916,7 +5572,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__laplace), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":73 + /* "nipy/labs/group/onesample.pyx":73 * 'student': FFF_ONESAMPLE_STUDENT, * 'laplace': FFF_ONESAMPLE_LAPLACE, * 'tukey': FFF_ONESAMPLE_TUKEY, # <<<<<<<<<<<<<< @@ -4928,7 +5584,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tukey), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":74 + /* "nipy/labs/group/onesample.pyx":74 * 'laplace': FFF_ONESAMPLE_LAPLACE, * 'tukey': FFF_ONESAMPLE_TUKEY, * 'sign': FFF_ONESAMPLE_SIGN_STAT, # <<<<<<<<<<<<<< @@ -4940,7 +5596,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sign), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":75 + /* "nipy/labs/group/onesample.pyx":75 * 'tukey': FFF_ONESAMPLE_TUKEY, * 'sign': FFF_ONESAMPLE_SIGN_STAT, * 'wilcoxon': FFF_ONESAMPLE_WILCOXON, # <<<<<<<<<<<<<< @@ -4952,7 +5608,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__wilcoxon), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":76 + /* "nipy/labs/group/onesample.pyx":76 * 'sign': FFF_ONESAMPLE_SIGN_STAT, * 'wilcoxon': FFF_ONESAMPLE_WILCOXON, * 'elr': FFF_ONESAMPLE_ELR, # <<<<<<<<<<<<<< @@ -4964,7 +5620,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__elr), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":77 + /* "nipy/labs/group/onesample.pyx":77 * 'wilcoxon': FFF_ONESAMPLE_WILCOXON, * 'elr': FFF_ONESAMPLE_ELR, * 'grubb': FFF_ONESAMPLE_GRUBB, # <<<<<<<<<<<<<< @@ -4976,7 +5632,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__grubb), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":78 + /* "nipy/labs/group/onesample.pyx":78 * 'elr': FFF_ONESAMPLE_ELR, * 'grubb': FFF_ONESAMPLE_GRUBB, * 'mean_mfx': FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, # <<<<<<<<<<<<<< @@ -4988,7 +5644,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mean_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":79 + /* "nipy/labs/group/onesample.pyx":79 * 'grubb': FFF_ONESAMPLE_GRUBB, * 'mean_mfx': FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, * 'median_mfx': FFF_ONESAMPLE_EMPIRICAL_MEDIAN_MFX, # <<<<<<<<<<<<<< @@ -5000,7 +5656,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__median_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":80 + /* "nipy/labs/group/onesample.pyx":80 * 'mean_mfx': FFF_ONESAMPLE_EMPIRICAL_MEAN_MFX, * 'median_mfx': FFF_ONESAMPLE_EMPIRICAL_MEDIAN_MFX, * 'mean_gauss_mfx': FFF_ONESAMPLE_GAUSSIAN_MEAN_MFX, # <<<<<<<<<<<<<< @@ -5012,7 +5668,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mean_gauss_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":81 + /* "nipy/labs/group/onesample.pyx":81 * 'median_mfx': FFF_ONESAMPLE_EMPIRICAL_MEDIAN_MFX, * 'mean_gauss_mfx': FFF_ONESAMPLE_GAUSSIAN_MEAN_MFX, * 'student_mfx': FFF_ONESAMPLE_STUDENT_MFX, # <<<<<<<<<<<<<< @@ -5024,7 +5680,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__student_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":82 + /* "nipy/labs/group/onesample.pyx":82 * 'mean_gauss_mfx': FFF_ONESAMPLE_GAUSSIAN_MEAN_MFX, * 'student_mfx': FFF_ONESAMPLE_STUDENT_MFX, * 'sign_mfx': FFF_ONESAMPLE_SIGN_STAT_MFX, # <<<<<<<<<<<<<< @@ -5036,7 +5692,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sign_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":83 + /* "nipy/labs/group/onesample.pyx":83 * 'student_mfx': FFF_ONESAMPLE_STUDENT_MFX, * 'sign_mfx': FFF_ONESAMPLE_SIGN_STAT_MFX, * 'wilcoxon_mfx': FFF_ONESAMPLE_WILCOXON_MFX, # <<<<<<<<<<<<<< @@ -5048,7 +5704,7 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__wilcoxon_mfx), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/onesample.pyx":84 + /* "nipy/labs/group/onesample.pyx":84 * 'sign_mfx': FFF_ONESAMPLE_SIGN_STAT_MFX, * 'wilcoxon_mfx': FFF_ONESAMPLE_WILCOXON_MFX, * 'elr_mfx': FFF_ONESAMPLE_ELR_MFX} # <<<<<<<<<<<<<< @@ -5062,17 +5718,77 @@ PyMODINIT_FUNC PyInit_onesample(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stats, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/group/onesample.pyx":88 + * + * # Test stat without mixed-effect correction + * def stat(ndarray Y, id='student', double base=0.0, # <<<<<<<<<<<<<< + * int axis=0, ndarray Magics=None): + * """ + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9onesample_1stat, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/onesample.pyx":157 + * + * + * def stat_mfx(ndarray Y, ndarray V, id='student_mfx', double base=0.0, # <<<<<<<<<<<<<< + * int axis=0, ndarray Magics=None, unsigned int niter=5): + * """ + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9onesample_3stat_mfx, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stat_mfx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/onesample.pyx":230 + * + * + * def pdf_fit_mfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (W, Z) = pdf_fit_mfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9onesample_5pdf_fit_mfx, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pdf_fit_mfx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/onesample.pyx":274 + * + * + * def pdf_fit_gmfx(ndarray Y, ndarray V, int axis=0, int niter=5, int constraint=0, double base=0.0): # <<<<<<<<<<<<<< + * """ + * (MU, S2) = pdf_fit_gmfx(data=Y, vardata=V, axis=0, niter=5, constraint=False, base=0.0). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9onesample_7pdf_fit_gmfx, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__pdf_fit_gmfx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/onesample.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.group.onesample"); + __Pyx_AddTraceback("init nipy.labs.group.onesample", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.group.onesample"); @@ -5086,15 +5802,36 @@ PyMODINIT_FUNC PyInit_onesample(void) #endif } -static const char *__pyx_filenames[] = { - "onesample.pyx", - "numpy.pxd", -}; - /* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseDoubleKeywordsError( @@ -5106,38 +5843,8 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif -} - -static void __Pyx_RaiseArgtupleInvalid( - const char* func_name, - int exact, - Py_ssize_t num_min, - Py_ssize_t num_max, - Py_ssize_t num_found) -{ - Py_ssize_t num_expected; - const char *number, *more_or_less; - - if (num_found < num_min) { - num_expected = num_min; - more_or_less = "at least"; - } else { - num_expected = num_max; - more_or_less = "at most"; - } - if (exact) { - more_or_less = "exactly"; - } - number = (num_expected == 1) ? "" : "s"; - PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", - #else - "%s() takes %s %zd positional argument%s (%zd given)", + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -5152,55 +5859,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; } + name++; } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -5219,42 +5948,290 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; } } - return item; + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); return -1; + } else { + return __Pyx_IterFinish(); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -5269,49 +6246,15 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(); - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -5321,44 +6264,79 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { goto bad; list = empty_list; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); } } @@ -5426,15 +6404,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -5501,152 +6524,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -5820,6 +6751,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -5841,9 +6791,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -5876,9 +6826,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -5911,9 +6861,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -5946,9 +6896,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -5981,9 +6931,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -6016,9 +6966,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -6030,24 +6980,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -6058,19 +7039,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -6079,54 +7064,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -6137,28 +7177,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -6166,11 +7223,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -6205,11 +7260,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/group/routines.c b/nipy/labs/group/routines.c index 8eacc85d0e..4a7c51eaea 100644 --- a/nipy/labs/group/routines.c +++ b/nipy/labs/group/routines.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:45:22 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:38 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,131 +227,107 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__group__routines #define __PYX_HAVE_API__nipy__labs__group__routines -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -281,8 +338,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -293,7 +348,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -301,50 +355,241 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "routines.pyx", + "numpy.pxd", + "type.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -365,20 +610,47 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -389,105 +661,110 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -/* Run-time type information about structs used with buffers */ -struct __Pyx_StructField_; - -typedef struct { - const char* name; /* for error messages only */ - struct __Pyx_StructField_* fields; - size_t size; /* sizeof(type) */ - char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ -} __Pyx_TypeInfo; - -typedef struct __Pyx_StructField_ { - __Pyx_TypeInfo* type; - const char* name; - size_t offset; -} __Pyx_StructField; +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -typedef struct { - __Pyx_StructField* field; - size_t parent_offset; -} __Pyx_BufFmt_StackElem; +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); - -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ #if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); #else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release #endif -Py_ssize_t __Pyx_zeros[] = {0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1}; -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -501,7 +778,6 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -522,11 +798,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -537,7 +819,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -552,11 +837,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -567,11 +858,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -590,6 +882,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -602,60 +896,90 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from cython */ -/* Module declarations from nipy.labs.group.routines */ +/* Module declarations from 'cython' */ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "numpy.float_t", NULL, sizeof(__pyx_t_5numpy_float_t), 'R' }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "numpy.int_t", NULL, sizeof(__pyx_t_5numpy_int_t), 'I' }; +/* Module declarations from 'nipy.labs.group.routines' */ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_float_t = { "float_t", NULL, sizeof(__pyx_t_5numpy_float_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int_t = { "int_t", NULL, sizeof(__pyx_t_5numpy_int_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_int_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_int_t), 0 }; #define __Pyx_MODULE_NAME "nipy.labs.group.routines" int __pyx_module_is_main_nipy__labs__group__routines = 0; -/* Implementation of nipy.labs.group.routines */ +/* Implementation of 'nipy.labs.group.routines' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_A, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_I); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nBasic ndarray routines for faster computations.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; -static char __pyx_k_9[] = "add_lines (line 16)"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nBasic ndarray routines for faster computations.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/group/routines.pyx"; +static char __pyx_k_18[] = "nipy.labs.group.routines"; static char __pyx_k__A[] = "A"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; @@ -669,43 +993,33 @@ static char __pyx_k__f[] = "f"; static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; +static char __pyx_k__j[] = "j"; static char __pyx_k__l[] = "l"; static char __pyx_k__q[] = "q"; static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__obj[] = "obj"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__i_max[] = "i_max"; +static char __pyx_k__index[] = "index"; +static char __pyx_k__j_max[] = "j_max"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__strides[] = "strides"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; static char __pyx_k__add_lines[] = "add_lines"; -static char __pyx_k__byteorder[] = "byteorder"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; -static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__A; static PyObject *__pyx_n_s__B; static PyObject *__pyx_n_s__I; @@ -715,27 +1029,99 @@ static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__add_lines; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; -static PyObject *__pyx_n_s__itemsize; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__i_max; +static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__j; +static PyObject *__pyx_n_s__j_max; static PyObject *__pyx_n_s__np; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__strides; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_codeobj_16; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_8routines_1add_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_8routines_add_lines[] = "\n add(A, B, I)\n\n Add each line of A to a line of B indexed by I, where\n A and B are two-dimensional arrays and I is a\n one-dimensional array of indices.\n\n This is equivalent to: \n\n for i in xrange(len(I)):\n B[I[i]] += A[i]\n\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_8routines_1add_lines = {__Pyx_NAMESTR("add_lines"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_8routines_1add_lines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_8routines_add_lines)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_8routines_1add_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_A = 0; + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_I = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("add_lines (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__I,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "add_lines") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_A = ((PyArrayObject *)values[0]); + __pyx_v_B = ((PyArrayObject *)values[1]); + __pyx_v_I = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("nipy.labs.group.routines.add_lines", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_5numpy_ndarray, 1, "A", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_I), __pyx_ptype_5numpy_ndarray, 1, "I", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_8routines_add_lines(__pyx_self, __pyx_v_A, __pyx_v_B, __pyx_v_I); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} -/* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":16 +/* "nipy/labs/group/routines.pyx":16 * * @cython.boundscheck(False) * def add_lines(np.ndarray[np.float_t, ndim=2] A, # <<<<<<<<<<<<<< @@ -743,31 +1129,20 @@ static PyObject *__pyx_int_15; * np.ndarray[np.int_t, ndim=1] I): */ -static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_8routines_add_lines[] = "\n add(A, B, I)\n\n Add each line of A to a line of B indexed by I, where\n A and B are two-dimensional arrays and I is a\n one-dimensional array of indices.\n\n This is equivalent to: \n\n for i in xrange(len(I)):\n B[I[i]] += A[i]\n\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyArrayObject *__pyx_v_A = 0; - PyArrayObject *__pyx_v_B = 0; - PyArrayObject *__pyx_v_I = 0; +static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_A, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_I) { int __pyx_v_i; int __pyx_v_j; int __pyx_v_index; int __pyx_v_i_max; int __pyx_v_j_max; - Py_buffer __pyx_bstruct_A; - Py_ssize_t __pyx_bstride_0_A = 0; - Py_ssize_t __pyx_bstride_1_A = 0; - Py_ssize_t __pyx_bshape_0_A = 0; - Py_ssize_t __pyx_bshape_1_A = 0; - Py_buffer __pyx_bstruct_B; - Py_ssize_t __pyx_bstride_0_B = 0; - Py_ssize_t __pyx_bstride_1_B = 0; - Py_ssize_t __pyx_bshape_0_B = 0; - Py_ssize_t __pyx_bshape_1_B = 0; - Py_buffer __pyx_bstruct_I; - Py_ssize_t __pyx_bstride_0_I = 0; - Py_ssize_t __pyx_bshape_0_I = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_A; + __Pyx_Buffer __pyx_pybuffer_A; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_I; + __Pyx_Buffer __pyx_pybuffer_I; PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; @@ -779,86 +1154,39 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx int __pyx_t_9; int __pyx_t_10; int __pyx_t_11; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__A,&__pyx_n_s__B,&__pyx_n_s__I,0}; - __Pyx_RefNannySetupContext("add_lines"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[3] = {0,0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__A); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__I); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "add_lines") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - __pyx_v_A = ((PyArrayObject *)values[0]); - __pyx_v_B = ((PyArrayObject *)values[1]); - __pyx_v_I = ((PyArrayObject *)values[2]); - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_A = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - __pyx_v_B = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_I = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("add_lines", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.routines.add_lines"); - return NULL; - __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_A); - __Pyx_INCREF((PyObject *)__pyx_v_B); - __Pyx_INCREF((PyObject *)__pyx_v_I); - __pyx_bstruct_A.buf = NULL; - __pyx_bstruct_B.buf = NULL; - __pyx_bstruct_I.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_A), __pyx_ptype_5numpy_ndarray, 1, "A", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_I), __pyx_ptype_5numpy_ndarray, 1, "I", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("add_lines", 0); + __pyx_pybuffer_A.pybuffer.buf = NULL; + __pyx_pybuffer_A.refcount = 0; + __pyx_pybuffernd_A.data = NULL; + __pyx_pybuffernd_A.rcbuffer = &__pyx_pybuffer_A; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_I.pybuffer.buf = NULL; + __pyx_pybuffer_I.refcount = 0; + __pyx_pybuffernd_I.data = NULL; + __pyx_pybuffernd_I.rcbuffer = &__pyx_pybuffer_I; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_A, (PyObject*)__pyx_v_A, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_A.rcbuffer->pybuffer, (PyObject*)__pyx_v_A, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_A = __pyx_bstruct_A.strides[0]; __pyx_bstride_1_A = __pyx_bstruct_A.strides[1]; - __pyx_bshape_0_A = __pyx_bstruct_A.shape[0]; __pyx_bshape_1_A = __pyx_bstruct_A.shape[1]; + __pyx_pybuffernd_A.diminfo[0].strides = __pyx_pybuffernd_A.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_A.diminfo[0].shape = __pyx_pybuffernd_A.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_A.diminfo[1].strides = __pyx_pybuffernd_A.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_A.diminfo[1].shape = __pyx_pybuffernd_A.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_B, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5numpy_float_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_B = __pyx_bstruct_B.strides[0]; __pyx_bstride_1_B = __pyx_bstruct_B.strides[1]; - __pyx_bshape_0_B = __pyx_bstruct_B.shape[0]; __pyx_bshape_1_B = __pyx_bstruct_B.shape[1]; + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_I, (PyObject*)__pyx_v_I, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_I.rcbuffer->pybuffer, (PyObject*)__pyx_v_I, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_I = __pyx_bstruct_I.strides[0]; - __pyx_bshape_0_I = __pyx_bstruct_I.shape[0]; + __pyx_pybuffernd_I.diminfo[0].strides = __pyx_pybuffernd_I.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_I.diminfo[0].shape = __pyx_pybuffernd_I.rcbuffer->pybuffer.shape[0]; - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":33 + /* "nipy/labs/group/routines.pyx":33 * """ * cdef int i, j, index * cdef int i_max = I.shape[0] # <<<<<<<<<<<<<< @@ -867,7 +1195,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx */ __pyx_v_i_max = (__pyx_v_I->dimensions[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":34 + /* "nipy/labs/group/routines.pyx":34 * cdef int i, j, index * cdef int i_max = I.shape[0] * cdef int j_max = B.shape[1] # <<<<<<<<<<<<<< @@ -876,7 +1204,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx */ __pyx_v_j_max = (__pyx_v_B->dimensions[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":36 + /* "nipy/labs/group/routines.pyx":36 * cdef int j_max = B.shape[1] * * for i in range(i_max): # <<<<<<<<<<<<<< @@ -887,7 +1215,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":37 + /* "nipy/labs/group/routines.pyx":37 * * for i in range(i_max): * index = I[i] # <<<<<<<<<<<<<< @@ -895,10 +1223,10 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx * B[index, j] = B[index, j] + A[i, j] */ __pyx_t_3 = __pyx_v_i; - if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_bshape_0_I; - __pyx_v_index = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_bstruct_I.buf, __pyx_t_3, __pyx_bstride_0_I)); + if (__pyx_t_3 < 0) __pyx_t_3 += __pyx_pybuffernd_I.diminfo[0].shape; + __pyx_v_index = (*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_int_t *, __pyx_pybuffernd_I.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_I.diminfo[0].strides)); - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":38 + /* "nipy/labs/group/routines.pyx":38 * for i in range(i_max): * index = I[i] * for j in range(j_max): # <<<<<<<<<<<<<< @@ -909,7 +1237,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_j = __pyx_t_5; - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":39 + /* "nipy/labs/group/routines.pyx":39 * index = I[i] * for j in range(j_max): * B[index, j] = B[index, j] + A[i, j] # <<<<<<<<<<<<<< @@ -917,17 +1245,17 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx */ __pyx_t_6 = __pyx_v_index; __pyx_t_7 = __pyx_v_j; - if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_bshape_0_B; - if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_bshape_1_B; + if (__pyx_t_6 < 0) __pyx_t_6 += __pyx_pybuffernd_B.diminfo[0].shape; + if (__pyx_t_7 < 0) __pyx_t_7 += __pyx_pybuffernd_B.diminfo[1].shape; __pyx_t_8 = __pyx_v_i; __pyx_t_9 = __pyx_v_j; - if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_bshape_0_A; - if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_bshape_1_A; + if (__pyx_t_8 < 0) __pyx_t_8 += __pyx_pybuffernd_A.diminfo[0].shape; + if (__pyx_t_9 < 0) __pyx_t_9 += __pyx_pybuffernd_A.diminfo[1].shape; __pyx_t_10 = __pyx_v_index; __pyx_t_11 = __pyx_v_j; - if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_bshape_0_B; - if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_bshape_1_B; - *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_B.buf, __pyx_t_10, __pyx_bstride_0_B, __pyx_t_11, __pyx_bstride_1_B) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_B.buf, __pyx_t_6, __pyx_bstride_0_B, __pyx_t_7, __pyx_bstride_1_B)) + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_bstruct_A.buf, __pyx_t_8, __pyx_bstride_0_A, __pyx_t_9, __pyx_bstride_1_A))); + if (__pyx_t_10 < 0) __pyx_t_10 += __pyx_pybuffernd_B.diminfo[0].shape; + if (__pyx_t_11 < 0) __pyx_t_11 += __pyx_pybuffernd_B.diminfo[1].shape; + *__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_11, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_B.diminfo[1].strides)) + (*__Pyx_BufPtrStrided2d(__pyx_t_5numpy_float_t *, __pyx_pybuffernd_A.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_A.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_A.diminfo[1].strides))); } } @@ -936,27 +1264,35 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx __pyx_L1_error:; { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_A); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_B); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_I); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_A.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("nipy.labs.group.routines.add_lines"); + __Pyx_AddTraceback("nipy.labs.group.routines.add_lines", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_A); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_B); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_I); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_A.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_I.rcbuffer->pybuffer); __pyx_L2:; - __Pyx_DECREF((PyObject *)__pyx_v_A); - __Pyx_DECREF((PyObject *)__pyx_v_B); - __Pyx_DECREF((PyObject *)__pyx_v_I); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -964,8 +1300,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_8routines_add_lines(PyObject *__pyx * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -977,23 +1312,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -1001,7 +1355,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1010,16 +1364,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1029,7 +1383,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1037,11 +1391,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1050,9 +1404,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1062,43 +1416,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1108,142 +1456,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1252,25 +1593,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1279,17 +1620,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1298,7 +1641,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1314,7 +1657,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1326,49 +1669,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -1379,50 +1723,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -1431,10 +1769,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1444,10 +1782,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1457,10 +1795,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1470,10 +1808,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1483,10 +1821,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1496,10 +1834,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1509,10 +1847,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1522,10 +1860,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1535,10 +1873,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1548,10 +1886,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1561,10 +1899,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1574,10 +1912,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1587,10 +1925,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1600,10 +1938,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1613,10 +1951,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -1626,10 +1964,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -1639,37 +1977,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -1678,7 +2016,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -1687,105 +2025,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -1793,11 +2140,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1807,7 +2154,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -1815,15 +2162,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -1833,10 +2179,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -1844,7 +2194,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1854,7 +2204,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1862,7 +2212,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -1872,10 +2222,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -1883,7 +2237,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1893,7 +2247,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1901,7 +2255,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -1911,10 +2265,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -1922,7 +2280,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1932,7 +2290,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1940,7 +2298,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -1950,10 +2308,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -1961,7 +2323,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1971,7 +2333,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1979,7 +2341,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -1989,10 +2351,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2000,7 +2366,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2010,7 +2376,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2018,7 +2384,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2027,33 +2393,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2062,7 +2428,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2071,167 +2437,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2239,16 +2632,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2257,469 +2649,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -2732,24 +3103,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -2759,12 +3129,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -2774,7 +3143,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -2786,7 +3155,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -2795,7 +3164,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -2806,7 +3175,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -2815,7 +3184,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -2824,12 +3193,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -2839,11 +3206,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -2853,7 +3220,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -2868,7 +3235,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -2882,24 +3249,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("add_lines"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_8routines_add_lines, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_8routines_add_lines)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("routines"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -2911,13 +3274,14 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, - {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, {&__pyx_n_s__I, __pyx_k__I, sizeof(__pyx_k__I), 0, 0, 1, 1}, @@ -2927,32 +3291,152 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__add_lines, __pyx_k__add_lines, sizeof(__pyx_k__add_lines), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__i_max, __pyx_k__i_max, sizeof(__pyx_k__i_max), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__j, __pyx_k__j, sizeof(__pyx_k__j), 0, 0, 1, 1}, + {&__pyx_n_s__j_max, __pyx_k__j_max, sizeof(__pyx_k__j_max), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/group/routines.pyx":16 + * + * @cython.boundscheck(False) + * def add_lines(np.ndarray[np.float_t, ndim=2] A, # <<<<<<<<<<<<<< + * np.ndarray[np.float_t, ndim=2] B, + * np.ndarray[np.int_t, ndim=1] I): + */ + __pyx_k_tuple_15 = PyTuple_New(8); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__A)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__A)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__A)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__B)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__B)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__B)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__I)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__I)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__I)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 3, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 4, ((PyObject *)__pyx_n_s__j)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__index)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 5, ((PyObject *)__pyx_n_s__index)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__index)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i_max)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 6, ((PyObject *)__pyx_n_s__i_max)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i_max)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__j_max)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 7, ((PyObject *)__pyx_n_s__j_max)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__j_max)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(3, 0, 8, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__add_lines, 16, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -2973,10 +3457,8 @@ PyMODINIT_FUNC PyInit_routines(void) #endif { PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -2984,14 +3466,19 @@ PyMODINIT_FUNC PyInit_routines(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_routines(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_routines(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -3002,16 +3489,23 @@ PyMODINIT_FUNC PyInit_routines(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("routines"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("routines"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.group.routines")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.group.routines", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3020,69 +3514,84 @@ PyMODINIT_FUNC PyInit_routines(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":8 + /* "nipy/labs/group/routines.pyx":8 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * import numpy as np */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":10 + /* "nipy/labs/group/routines.pyx":10 * __version__ = '0.1' * * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/routines.pyx":1 + /* "nipy/labs/group/routines.pyx":16 + * + * @cython.boundscheck(False) + * def add_lines(np.ndarray[np.float_t, ndim=2] A, # <<<<<<<<<<<<<< + * np.ndarray[np.float_t, ndim=2] B, + * np.ndarray[np.int_t, ndim=1] I): + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_8routines_1add_lines, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__add_lines, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/routines.pyx":1 * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< * """ * Basic ndarray routines for faster computations. */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__add_lines); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/stdlib.pxd":2 + /* "numpy.pxd":975 + * arr.base = baseptr * - * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< - * void free(void *ptr) - * void *malloc(size_t size) + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.group.routines"); + __Pyx_AddTraceback("init nipy.labs.group.routines", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.group.routines"); @@ -3096,28 +3605,36 @@ PyMODINIT_FUNC PyInit_routines(void) #endif } -static const char *__pyx_filenames[] = { - "routines.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseArgtupleInvalid( @@ -3128,8 +3645,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -3140,14 +3656,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -3162,55 +3687,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -3229,21 +3776,30 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { unsigned int n = 1; return *(unsigned char*)(&n) != 0; } - -typedef struct { - __Pyx_StructField root; - __Pyx_BufFmt_StackElem* head; - size_t fmt_offset; - int new_count, enc_count; - int is_complex; - char enc_type; - char packmode; -} __Pyx_BufFmt_Context; - static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, __Pyx_BufFmt_StackElem* stack, __Pyx_TypeInfo* type) { @@ -3256,11 +3812,14 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, ctx->head->field = &ctx->root; ctx->fmt_offset = 0; ctx->head->parent_offset = 0; - ctx->packmode = '@'; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; while (type->typegroup == 'S') { ++ctx->head; ctx->head->field = type->fields; @@ -3268,7 +3827,6 @@ static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, type = type->fields->type; } } - static int __Pyx_BufFmt_ParseNumber(const char** ts) { int count; const char* t = *ts; @@ -3284,15 +3842,21 @@ static int __Pyx_BufFmt_ParseNumber(const char** ts) { *ts = t; return count; } - +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { - char msg[] = {ch, 0}; - PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); } - static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { switch (ch) { - case 'b': return "'char'"; + case 'c': return "'char'"; + case 'b': return "'signed char'"; case 'B': return "'unsigned char'"; case 'h': return "'short'"; case 'H': return "'unsigned short'"; @@ -3308,14 +3872,14 @@ static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 's': case 'p': return "a string"; case 0: return "end"; default: return "unparseable format string"; } } - static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return 2; case 'i': case 'I': case 'l': case 'L': return 4; case 'q': case 'Q': return 8; @@ -3331,10 +3895,9 @@ static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { return 0; } } - static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'B': return 1; + case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(short); case 'i': case 'I': return sizeof(int); case 'l': case 'L': return sizeof(long); @@ -3348,10 +3911,9 @@ static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; - } + } } } - typedef struct { char c; short x; } __Pyx_st_short; typedef struct { char c; int x; } __Pyx_st_int; typedef struct { char c; long x; } __Pyx_st_long; @@ -3360,17 +3922,16 @@ typedef struct { char c; double x; } __Pyx_st_double; typedef struct { char c; long double x; } __Pyx_st_longdouble; typedef struct { char c; void *x; } __Pyx_st_void_p; #ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; #endif - -static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { switch (ch) { - case '?': case 'c': case 'b': case 'B': return 1; + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); #ifdef HAVE_LONG_LONG - case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); #endif case 'f': return sizeof(__Pyx_st_float) - sizeof(float); case 'd': return sizeof(__Pyx_st_double) - sizeof(double); @@ -3381,21 +3942,59 @@ static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { return 0; } } - -static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { switch (ch) { - case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; - case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; - case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); - case 'O': return 'O'; - case 'P': return 'P'; + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; default: { __Pyx_BufFmt_RaiseUnexpectedChar(ch); return 0; - } + } } } - static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { if (ctx->head == NULL || ctx->head->field == &ctx->root) { const char* expected; @@ -3420,56 +4019,77 @@ static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { parent->type->name, field->name); } } - static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { char group; - size_t size, offset; + size_t size, offset, arraysize = 1; if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); do { __Pyx_StructField* field = ctx->head->field; __Pyx_TypeInfo* type = field->type; - - if (ctx->packmode == '@' || ctx->packmode == '^') { + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); } else { size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); } - if (ctx->packmode == '@') { - int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); - int align_mod_offset; + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; if (align_at == 0) return -1; align_mod_offset = ctx->fmt_offset % align_at; if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); } - if (type->size != size || type->typegroup != group) { if (type->typegroup == 'C' && type->fields != NULL) { - /* special case -- treat as struct rather than complex number */ size_t parent_offset = ctx->head->parent_offset + field->offset; ++ctx->head; ctx->head->field = type->fields; ctx->head->parent_offset = parent_offset; continue; } - - __Pyx_BufFmt_RaiseExpected(ctx); - return -1; + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } } - offset = ctx->head->parent_offset + field->offset; if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " - "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); return -1; } - ctx->fmt_offset += size; - + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; --ctx->enc_count; /* Consume from buffer string */ - - /* Done checking, move to next field, pushing or popping struct stack if needed */ while (1) { if (field == &ctx->root) { ctx->head = NULL; @@ -3499,17 +4119,50 @@ static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { } while (ctx->enc_count); ctx->enc_type = 0; ctx->is_complex = 0; - return 0; -} - -static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { - if (ctx->enc_type != 0 || ctx->packmode != '@') { - PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); - return -1; - } return 0; } - +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { int got_Z = 0; while (1) { @@ -3524,7 +4177,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha __Pyx_BufFmt_RaiseExpected(ctx); return NULL; } - return ts; + return ts; case ' ': case 10: case 13: @@ -3535,8 +4188,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); return NULL; } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; + ctx->new_packmode = '='; ++ts; break; case '>': @@ -3545,27 +4197,29 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); return NULL; } - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = '='; + ctx->new_packmode = '='; ++ts; break; case '=': case '@': case '^': - if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; - ctx->packmode = *ts++; + ctx->new_packmode = *ts++; break; case 'T': /* substruct */ { - int i; const char* ts_after_sub; - int struct_count = ctx->new_count; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; ctx->new_count = 1; ++ts; if (*ts != '{') { PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); return NULL; } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; ++ts; ts_after_sub = ts; for (i = 0; i != struct_count; ++i) { @@ -3573,10 +4227,19 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha if (!ts_after_sub) return NULL; } ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; } break; case '}': /* end of substruct; either repeat or move on */ - ++ts; + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } return ts; case 'x': if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; @@ -3584,6 +4247,7 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha ctx->new_count = 1; ctx->enc_count = 0; ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; ++ts; break; case 'Z': @@ -3596,14 +4260,14 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': - case 'O': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { - /* Continue pooling same type */ + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { ctx->enc_count += ctx->new_count; } else { - /* New type */ if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; ctx->enc_type = *ts; ctx->is_complex = got_Z; } @@ -3611,21 +4275,23 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha ctx->new_count = 1; got_Z = 0; break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; default: { - ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); - if (ctx->new_count == -1) { /* First char was not a digit */ - char msg[2] = { *ts, 0 }; - PyErr_Format(PyExc_ValueError, - "Does not understand character buffer dtype format string ('%s')", msg); - return NULL; - } + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; } - } } } - static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->buf = NULL; buf->obj = NULL; @@ -3633,9 +4299,11 @@ static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { buf->shape = __Pyx_zeros; buf->suboffsets = __Pyx_minusones; } - -static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { - if (obj == Py_None) { +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { __Pyx_ZeroBuffer(buf); return 0; } @@ -3654,10 +4322,9 @@ static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeI } if ((unsigned)buf->itemsize != dtype->size) { PyErr_Format(PyExc_ValueError, - "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", buf->itemsize, (buf->itemsize > 1) ? "s" : "", - dtype->name, - dtype->size, (dtype->size > 1) ? "s" : ""); + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); goto fail; } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; @@ -3666,7 +4333,6 @@ fail:; __Pyx_ZeroBuffer(buf); return -1; } - static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { if (info->buf == NULL) return; if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; @@ -3674,9 +4340,9 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; @@ -3686,136 +4352,328 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } - static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } - -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); -} - -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; } - -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; } + PyException_SetCause(value, fixed_cause); } - return item; + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); - return -1; - } - else if (!PyErr_Occurred()) - return 0; - else - return -1; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (likely(PyObject_TypeCheck(obj, type))) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(); + return __Pyx_IterFinish(); } + return 0; } -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; } #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + CYTHON_UNUSED PyObject *getbuffer_cobj; #if PY_VERSION_HEX >= 0x02060000 - if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) - return PyObject_GetBuffer(obj, view, flags); + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); #endif - if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pf_5numpy_7ndarray___getbuffer__(obj, view, flags); - else { - PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); - return -1; + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (getbuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_getbuffer"))) { + getbufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (getbufferproc) PyCapsule_GetPointer(getbuffer_cobj, "getbuffer(obj, view, flags)"); + #else + func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + #endif + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; } - static void __Pyx_ReleaseBuffer(Py_buffer *view) { - PyObject* obj = view->obj; - if (obj) { -if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) __pyx_pf_5numpy_7ndarray___releasebuffer__(obj, view); + PyObject *obj = view->obj; + CYTHON_UNUSED PyObject *releasebuffer_cobj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict && + (releasebuffer_cobj = PyMapping_GetItemString(obj->ob_type->tp_dict, + "__pyx_releasebuffer"))) { + releasebufferproc func; + #if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 0) + func = (releasebufferproc) PyCapsule_GetPointer(releasebuffer_cobj, "releasebuffer(obj, view)"); + #else + func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + #endif + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: Py_DECREF(obj); view->obj = NULL; - } } +#endif /* PY_MAJOR_VERSION < 3 */ -#endif -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -3831,23 +4689,51 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -3912,15 +4798,60 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -3987,125 +4918,60 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -4279,6 +5145,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -4300,9 +5185,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -4335,9 +5220,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -4370,9 +5255,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -4405,9 +5290,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -4440,9 +5325,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -4475,9 +5360,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -4489,24 +5374,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -4517,19 +5433,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -4538,54 +5458,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -4596,28 +5571,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -4625,11 +5617,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -4664,11 +5654,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/group/twosample.c b/nipy/labs/group/twosample.c index 151e5d9145..db3cb9fdee 100644 --- a/nipy/labs/group/twosample.c +++ b/nipy/labs/group/twosample.c @@ -1,36 +1,68 @@ -/* Generated by Cython 0.12.1 on Tue Mar 15 18:44:59 2011 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:39 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" -#include "structmember.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. #else - -#ifndef PY_LONG_LONG - #define PY_LONG_LONG LONG_LONG +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif -#if PY_VERSION_HEX < 0x02040000 - #define METH_COEXIST 0 - #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) - #define PyDict_Contains(d,o) PySequence_Contains(d,o) +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) PyInt_AsLong(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -52,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -62,34 +92,79 @@ #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact -#else +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -103,32 +178,39 @@ #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask - #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) -#else - #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - #endif - #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) + #define PyBoolObject PyLongObject #endif - -#if !defined(WIN32) && !defined(MS_WINDOWS) - #ifndef __stdcall - #define __stdcall - #endif - #ifndef __cdecl - #define __cdecl - #endif - #ifndef __fastcall - #define __fastcall - #endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else - #define _USE_MATH_DEFINES + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -146,15 +227,32 @@ #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif -#ifdef __cplusplus -#define __PYX_EXTERN_C extern "C" + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else -#define __PYX_EXTERN_C extern + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES #endif #include +#define __PYX_HAVE__nipy__labs__group__twosample #define __PYX_HAVE_API__nipy__labs__group__twosample -#include "stdlib.h" #include "stdio.h" +#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "fff_base.h" @@ -163,120 +261,79 @@ #include "fff_array.h" #include "fffpy.h" #include "fff_twosample_stat.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + + +/* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline #else - #define CYTHON_INLINE + #define CYTHON_INLINE #endif #endif +/* unused attribute */ +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif + typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize -#define __Pyx_PyBytes_AsString PyString_AsString -#else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize -#define __Pyx_PyBytes_AsString PyBytes_AsString -#endif - -#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) -#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); -#if !defined(T_PYSSIZET) -#if PY_VERSION_HEX < 0x02050000 -#define T_PYSSIZET T_INT -#elif !defined(T_LONGLONG) -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) -#else -#define T_PYSSIZET \ - ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ - ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ - ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) -#endif -#endif - - -#if !defined(T_ULONGLONG) -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) -#else -#define __Pyx_T_UNSIGNED_INT(x) \ - ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ - ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ - ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) -#endif -#if !defined(T_LONGLONG) -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) -#else -#define __Pyx_T_SIGNED_INT(x) \ - ((sizeof(x) == sizeof(char)) ? T_BYTE : \ - ((sizeof(x) == sizeof(short)) ? T_SHORT : \ - ((sizeof(x) == sizeof(int)) ? T_INT : \ - ((sizeof(x) == sizeof(long)) ? T_LONG : \ - ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) -#endif - -#define __Pyx_T_FLOATING(x) \ - ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ - ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) - -#if !defined(T_SIZET) -#if !defined(T_ULONGLONG) -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) -#else -#define T_SIZET \ - ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ - ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ - ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) -#endif -#endif - static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) - +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ -/* Test for GCC > 2.95 */ -#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) -#define likely(x) __builtin_expect(!!(x), 1) -#define unlikely(x) __builtin_expect(!!(x), 0) -#else /* __GNUC__ > 2 ... */ -#define likely(x) (x) -#define unlikely(x) (x) -#endif /* __GNUC__ > 2 ... */ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ -#define likely(x) (x) -#define unlikely(x) (x) + #define likely(x) (x) + #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; @@ -287,8 +344,6 @@ static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; -static const char **__pyx_f; - #if !defined(CYTHON_CCOMPLEX) #if defined(__cplusplus) @@ -299,7 +354,6 @@ static const char **__pyx_f; #define CYTHON_CCOMPLEX 0 #endif #endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus #include @@ -307,52 +361,215 @@ static const char **__pyx_f; #include #endif #endif - #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) #undef _Complex_I #define _Complex_I 1.0fj #endif + +static const char *__pyx_f[] = { + "twosample.pyx", + "numpy.pxd", + "type.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ typedef npy_int8 __pyx_t_5numpy_int8_t; +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ typedef npy_int16 __pyx_t_5numpy_int16_t; +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ typedef npy_int32 __pyx_t_5numpy_int32_t; +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ typedef npy_int64 __pyx_t_5numpy_int64_t; +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ typedef npy_float32 __pyx_t_5numpy_float32_t; +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ typedef npy_float64 __pyx_t_5numpy_float64_t; +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ typedef npy_long __pyx_t_5numpy_int_t; +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ typedef npy_ulong __pyx_t_5numpy_uint_t; +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ typedef npy_double __pyx_t_5numpy_float_t; +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ typedef npy_double __pyx_t_5numpy_double_t; +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* "fff.pxd":9 + * + * # Redefine size_t + * ctypedef unsigned long int size_t # <<<<<<<<<<<<<< + * + * + */ typedef unsigned long __pyx_t_3fff_size_t; - #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -373,20 +590,47 @@ typedef unsigned long __pyx_t_3fff_size_t; typedef struct { double real, imag; } __pyx_t_double_complex; #endif -/* Type declarations */ +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ typedef npy_cdouble __pyx_t_5numpy_complex_t; - #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif - #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); @@ -397,50 +641,80 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else - #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) -#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ -#define __Pyx_SetItemInt(o, i, v, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ - __Pyx_SetItemInt_Fast(o, i, v, size <= sizeof(long)) : \ - __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif +#define __Pyx_SetItemInt(o, i, v, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { int r; if (!j) return -1; @@ -448,43 +722,60 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb Py_DECREF(j); return r; } - -static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, int fits_long) { - if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { - Py_INCREF(v); - Py_DECREF(PyList_GET_ITEM(o, i)); - PyList_SET_ITEM(o, i, v); - return 1; +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON + if (PyList_CheckExact(o)) { + Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { /* inlined PySequence_SetItem() */ + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } + return m->sq_ass_item(o, i, v); + } } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_ass_item && (likely(i >= 0))) +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif return PySequence_SetItem(o, i, v); - else { - PyObject *j = fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i); - return __Pyx_SetItemInt_Generic(o, j, v); } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -498,7 +789,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #define __Pyx_CREAL(z) ((z).real) #define __Pyx_CIMAG(z) ((z).imag) #endif - #if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX #define __Pyx_SET_CREAL(z,x) ((z).real(x)) #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) @@ -519,11 +809,17 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa #ifdef __cplusplus #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) - /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zerof(z) ((z)==0) #define __Pyx_c_conjf(z) (conjf(z)) - /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); @@ -534,7 +830,10 @@ static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(floa static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif #endif static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); @@ -549,11 +848,17 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do #ifdef __cplusplus #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) - /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif #else #define __Pyx_c_is_zero(z) ((z)==0) #define __Pyx_c_conj(z) (conj(z)) - /*#define __Pyx_c_abs(z) (cabs(z))*/ + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif #endif #else static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); @@ -564,14 +869,12 @@ static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(do static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -590,6 +893,8 @@ static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); @@ -602,63 +907,97 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static int __Pyx_check_binary_version(void); + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ -/* Module declarations from python_buffer */ -/* Module declarations from python_ref */ -/* Module declarations from stdlib */ +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.stdio' */ -/* Module declarations from stdio */ +/* Module declarations from 'cpython.object' */ -/* Module declarations from numpy */ +/* Module declarations from '__builtin__' */ -/* Module declarations from numpy */ +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ -/* Module declarations from fff */ -/* Module declarations from nipy.labs.group.twosample */ +/* Module declarations from 'fff' */ +/* Module declarations from 'nipy.labs.group.twosample' */ #define __Pyx_MODULE_NAME "nipy.labs.group.twosample" int __pyx_module_is_main_nipy__labs__group__twosample = 0; -/* Implementation of nipy.labs.group.twosample */ +/* Implementation of 'nipy.labs.group.twosample' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_n1, unsigned int __pyx_v_n2); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_2stat(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y1, PyArrayObject *__pyx_v_Y2, PyObject *__pyx_v_id, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics); /* proto */ +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_4stat_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y1, PyArrayObject *__pyx_v_V1, PyArrayObject *__pyx_v_Y2, PyArrayObject *__pyx_v_V2, PyObject *__pyx_v_id, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics, unsigned int __pyx_v_niter); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = "\nRoutines for massively univariate random-effect and mixed-effect\nanalysis. Two-sample case.\n\nAuthor: Alexis Roche, 2008.\n"; -static char __pyx_k_8[] = "0.1"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_7[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_8[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_11[] = "Format string allocated too short."; +static char __pyx_k_13[] = "\nRoutines for massively univariate random-effect and mixed-effect\nanalysis. Two-sample case.\n\nAuthor: Alexis Roche, 2008.\n"; +static char __pyx_k_14[] = "0.1"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/group/twosample.pyx"; +static char __pyx_k_18[] = "nipy.labs.group.twosample"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; static char __pyx_k__L[] = "L"; static char __pyx_k__O[] = "O"; static char __pyx_k__Q[] = "Q"; +static char __pyx_k__T[] = "T"; static char __pyx_k__b[] = "b"; static char __pyx_k__d[] = "d"; static char __pyx_k__f[] = "f"; @@ -666,7 +1005,9 @@ static char __pyx_k__g[] = "g"; static char __pyx_k__h[] = "h"; static char __pyx_k__i[] = "i"; static char __pyx_k__l[] = "l"; +static char __pyx_k__n[] = "n"; static char __pyx_k__q[] = "q"; +static char __pyx_k__t[] = "t"; static char __pyx_k__V1[] = "V1"; static char __pyx_k__V2[] = "V2"; static char __pyx_k__Y1[] = "Y1"; @@ -678,151 +1019,188 @@ static char __pyx_k__id[] = "id"; static char __pyx_k__n1[] = "n1"; static char __pyx_k__n2[] = "n2"; static char __pyx_k__np[] = "np"; -static char __pyx_k__buf[] = "buf"; -static char __pyx_k__obj[] = "obj"; +static char __pyx_k__v1[] = "v1"; +static char __pyx_k__v2[] = "v2"; +static char __pyx_k__vp[] = "vp"; +static char __pyx_k__y1[] = "y1"; +static char __pyx_k__y2[] = "y2"; +static char __pyx_k__yp[] = "yp"; +static char __pyx_k__idx[] = "idx"; +static char __pyx_k__nex[] = "nex"; static char __pyx_k__axis[] = "axis"; -static char __pyx_k__base[] = "base"; -static char __pyx_k__data[] = "data"; -static char __pyx_k__ndim[] = "ndim"; -static char __pyx_k__size[] = "size"; -static char __pyx_k__descr[] = "descr"; -static char __pyx_k__index[] = "index"; -static char __pyx_k__names[] = "names"; +static char __pyx_k__dims[] = "dims"; +static char __pyx_k__idx1[] = "idx1"; +static char __pyx_k__idx2[] = "idx2"; +static char __pyx_k__simu[] = "simu"; +static char __pyx_k__stat[] = "stat"; +static char __pyx_k__magic[] = "magic"; +static char __pyx_k__multi[] = "multi"; static char __pyx_k__niter[] = "niter"; +static char __pyx_k__nsimu[] = "nsimu"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; -static char __pyx_k__shape[] = "shape"; static char __pyx_k__stats[] = "stats"; static char __pyx_k__zeros[] = "zeros"; static char __pyx_k__Magics[] = "Magics"; -static char __pyx_k__fields[] = "fields"; -static char __pyx_k__format[] = "format"; -static char __pyx_k__stride[] = "stride"; -static char __pyx_k__vector[] = "vector"; -static char __pyx_k__strides[] = "strides"; +static char __pyx_k__magics[] = "magics"; static char __pyx_k__student[] = "student"; static char __pyx_k____main__[] = "__main__"; -static char __pyx_k__itemsize[] = "itemsize"; -static char __pyx_k__readonly[] = "readonly"; -static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__stat_mfx[] = "stat_mfx"; static char __pyx_k__wilcoxon[] = "wilcoxon"; -static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__flag_stat[] = "flag_stat"; static char __pyx_k__ValueError[] = "ValueError"; -static char __pyx_k__suboffsets[] = "suboffsets"; static char __pyx_k____version__[] = "__version__"; static char __pyx_k__student_mfx[] = "student_mfx"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__count_permutations[] = "count_permutations"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_n_s_18; static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; -static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; static PyObject *__pyx_n_s__Magics; static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__T; static PyObject *__pyx_n_s__V1; static PyObject *__pyx_n_s__V2; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s__Y1; static PyObject *__pyx_n_s__Y2; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__axis; -static PyObject *__pyx_n_s__base; -static PyObject *__pyx_n_s__buf; -static PyObject *__pyx_n_s__byteorder; -static PyObject *__pyx_n_s__data; -static PyObject *__pyx_n_s__descr; -static PyObject *__pyx_n_s__fields; -static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__count_permutations; +static PyObject *__pyx_n_s__dims; +static PyObject *__pyx_n_s__flag_stat; +static PyObject *__pyx_n_s__i; static PyObject *__pyx_n_s__id; -static PyObject *__pyx_n_s__index; -static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__idx; +static PyObject *__pyx_n_s__idx1; +static PyObject *__pyx_n_s__idx2; +static PyObject *__pyx_n_s__magic; +static PyObject *__pyx_n_s__magics; +static PyObject *__pyx_n_s__multi; +static PyObject *__pyx_n_s__n; static PyObject *__pyx_n_s__n1; static PyObject *__pyx_n_s__n2; -static PyObject *__pyx_n_s__names; -static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__nex; static PyObject *__pyx_n_s__niter; static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__nsimu; static PyObject *__pyx_n_s__numpy; -static PyObject *__pyx_n_s__obj; static PyObject *__pyx_n_s__range; -static PyObject *__pyx_n_s__readonly; -static PyObject *__pyx_n_s__shape; -static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__simu; +static PyObject *__pyx_n_s__stat; +static PyObject *__pyx_n_s__stat_mfx; static PyObject *__pyx_n_s__stats; -static PyObject *__pyx_n_s__stride; -static PyObject *__pyx_n_s__strides; static PyObject *__pyx_n_s__student; static PyObject *__pyx_n_s__student_mfx; -static PyObject *__pyx_n_s__suboffsets; -static PyObject *__pyx_n_s__type_num; -static PyObject *__pyx_n_s__vector; +static PyObject *__pyx_n_s__t; +static PyObject *__pyx_n_s__v1; +static PyObject *__pyx_n_s__v2; +static PyObject *__pyx_n_s__vp; static PyObject *__pyx_n_s__wilcoxon; +static PyObject *__pyx_n_s__y1; +static PyObject *__pyx_n_s__y2; +static PyObject *__pyx_n_s__yp; static PyObject *__pyx_n_s__zeros; static PyObject *__pyx_int_15; - -/* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":60 - * - * - * def count_permutations(unsigned int n1, unsigned int n2): # <<<<<<<<<<<<<< - * cdef double n - * fff_twosample_permutation(NULL, NULL, n1, n2, &n) - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_tuple_4; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_9; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; +static PyObject *__pyx_k_codeobj_16; +static PyObject *__pyx_k_codeobj_20; +static PyObject *__pyx_k_codeobj_22; + +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_1count_permutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9twosample_1count_permutations = {__Pyx_NAMESTR("count_permutations"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9twosample_1count_permutations, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_1count_permutations(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { unsigned int __pyx_v_n1; unsigned int __pyx_v_n2; - double __pyx_v_n; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n1,&__pyx_n_s__n2,0}; - __Pyx_RefNannySetupContext("count_permutations"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("count_permutations (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n1,&__pyx_n_s__n2,0}; PyObject* values[2] = {0,0}; - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n1); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n2); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("count_permutations", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "count_permutations") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("count_permutations", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "count_permutations") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_n1 = __Pyx_PyInt_AsUnsignedInt(values[0]); if (unlikely((__pyx_v_n1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_n2 = __Pyx_PyInt_AsUnsignedInt(values[1]); if (unlikely((__pyx_v_n2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - __pyx_v_n1 = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_n1 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_n2 = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_n2 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("count_permutations", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.twosample.count_permutations"); + __Pyx_AddTraceback("nipy.labs.group.twosample.count_permutations", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(__pyx_self, __pyx_v_n1, __pyx_v_n2); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/group/twosample.pyx":60 + * + * + * def count_permutations(unsigned int n1, unsigned int n2): # <<<<<<<<<<<<<< + * cdef double n + * fff_twosample_permutation(NULL, NULL, n1, n2, &n) + */ + +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(CYTHON_UNUSED PyObject *__pyx_self, unsigned int __pyx_v_n1, unsigned int __pyx_v_n2) { + double __pyx_v_n; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("count_permutations", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":62 + /* "nipy/labs/group/twosample.pyx":62 * def count_permutations(unsigned int n1, unsigned int n2): * cdef double n * fff_twosample_permutation(NULL, NULL, n1, n2, &n) # <<<<<<<<<<<<<< @@ -831,7 +1209,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObj */ fff_twosample_permutation(NULL, NULL, __pyx_v_n1, __pyx_v_n2, (&__pyx_v_n)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":63 + /* "nipy/labs/group/twosample.pyx":63 * cdef double n * fff_twosample_permutation(NULL, NULL, n1, n2, &n) * return int(n) # <<<<<<<<<<<<<< @@ -846,9 +1224,9 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObj PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyInt_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; @@ -858,7 +1236,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObj __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("nipy.labs.group.twosample.count_permutations"); + __Pyx_AddTraceback("nipy.labs.group.twosample.count_permutations", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -866,100 +1244,84 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations(PyObj return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":66 - * - * - * def stat(ndarray Y1, ndarray Y2, id='student', int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< - * """ - * T = stat(Y1, Y2, id='student', axis=0, magics=None). - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_9twosample_stat[] = "\n T = stat(Y1, Y2, id='student', axis=0, magics=None).\n \n Compute a two-sample test statistic (Y1>Y2) over a number of\n deterministic or random permutations.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_3stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_9twosample_2stat[] = "\n T = stat(Y1, Y2, id='student', axis=0, magics=None).\n \n Compute a two-sample test statistic (Y1>Y2) over a number of\n deterministic or random permutations.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9twosample_3stat = {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9twosample_3stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9twosample_2stat)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_3stat(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y1 = 0; PyArrayObject *__pyx_v_Y2 = 0; PyObject *__pyx_v_id = 0; int __pyx_v_axis; PyArrayObject *__pyx_v_Magics = 0; - fff_vector *__pyx_v_y1; - fff_vector *__pyx_v_y2; - fff_vector *__pyx_v_t; - fff_vector *__pyx_v_yp; - fff_vector *__pyx_v_magics; - fff_array *__pyx_v_idx1; - fff_array *__pyx_v_idx2; - unsigned int __pyx_v_n; - unsigned int __pyx_v_n1; - unsigned int __pyx_v_n2; - unsigned int __pyx_v_nex; - unsigned long __pyx_v_simu; - unsigned long __pyx_v_nsimu; - unsigned long __pyx_v_idx; - fff_twosample_stat *__pyx_v_stat; - fff_twosample_stat_flag __pyx_v_flag_stat; - double __pyx_v_magic; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_T; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - fff_twosample_stat_flag __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - unsigned long __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y1,&__pyx_n_s__Y2,&__pyx_n_s__id,&__pyx_n_s__axis,&__pyx_n_s__Magics,0}; - __Pyx_RefNannySetupContext("stat"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stat (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y1,&__pyx_n_s__Y2,&__pyx_n_s__id,&__pyx_n_s__axis,&__pyx_n_s__Magics,0}; PyObject* values[5] = {0,0,0,0,0}; values[2] = ((PyObject *)__pyx_n_s__student); - values[4] = (PyObject*)((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y1); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y2); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("stat", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + + /* "nipy/labs/group/twosample.pyx":66 + * + * + * def stat(ndarray Y1, ndarray Y2, id='student', int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< + * """ + * T = stat(Y1, Y2, id='student', axis=0, magics=None). + */ + values[4] = (PyObject *)((PyArrayObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 2: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); - if (unlikely(value)) { values[2] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("stat", 0, 2, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (value) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); + if (value) { values[4] = value; kw_args--; } + } } - case 3: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[3] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); - if (unlikely(value)) { values[4] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "stat") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y1 = ((PyArrayObject *)values[0]); __pyx_v_Y2 = ((PyArrayObject *)values[1]); __pyx_v_id = values[2]; @@ -969,43 +1331,66 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel __pyx_v_axis = ((int)0); } __pyx_v_Magics = ((PyArrayObject *)values[4]); - } else { - __pyx_v_id = ((PyObject *)__pyx_n_s__student); - __pyx_v_axis = ((int)0); - __pyx_v_Magics = ((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: - __pyx_v_Magics = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 4)); - case 4: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: - __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: - __pyx_v_Y2 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y1 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("stat", 0, 2, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.twosample.stat"); + __Pyx_AddTraceback("nipy.labs.group.twosample.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y1); - __Pyx_INCREF((PyObject *)__pyx_v_Y2); - __Pyx_INCREF(__pyx_v_id); - __Pyx_INCREF((PyObject *)__pyx_v_Magics); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_T = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y1), __pyx_ptype_5numpy_ndarray, 1, "Y1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y2), __pyx_ptype_5numpy_ndarray, 1, "Y2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Magics), __pyx_ptype_5numpy_ndarray, 1, "Magics", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_9twosample_2stat(__pyx_self, __pyx_v_Y1, __pyx_v_Y2, __pyx_v_id, __pyx_v_axis, __pyx_v_Magics); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_2stat(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y1, PyArrayObject *__pyx_v_Y2, PyObject *__pyx_v_id, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics) { + fff_vector *__pyx_v_y1; + fff_vector *__pyx_v_y2; + fff_vector *__pyx_v_t; + fff_vector *__pyx_v_yp; + fff_vector *__pyx_v_magics; + fff_array *__pyx_v_idx1; + fff_array *__pyx_v_idx2; + unsigned int __pyx_v_n; + unsigned int __pyx_v_n1; + unsigned int __pyx_v_n2; + unsigned int __pyx_v_nex; + unsigned long __pyx_v_simu; + unsigned long __pyx_v_nsimu; + unsigned long __pyx_v_idx; + fff_twosample_stat *__pyx_v_stat; + fff_twosample_stat_flag __pyx_v_flag_stat; + double __pyx_v_magic; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_T = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + fff_twosample_stat_flag __pyx_t_3; + int __pyx_t_4; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + unsigned long __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stat", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":78 + /* "nipy/labs/group/twosample.pyx":78 * cdef unsigned long int simu, nsimu, idx * cdef fff_twosample_stat* stat * cdef fff_twosample_stat_flag flag_stat = stats[id] # <<<<<<<<<<<<<< @@ -1021,7 +1406,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_flag_stat = __pyx_t_3; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":83 + /* "nipy/labs/group/twosample.pyx":83 * * # Get number of observations * n1 = Y1.shape[axis] # <<<<<<<<<<<<<< @@ -1030,7 +1415,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_n1 = ((unsigned int)(__pyx_v_Y1->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":84 + /* "nipy/labs/group/twosample.pyx":84 * # Get number of observations * n1 = Y1.shape[axis] * n2 = Y2.shape[axis] # <<<<<<<<<<<<<< @@ -1039,7 +1424,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_n2 = ((unsigned int)(__pyx_v_Y2->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":85 + /* "nipy/labs/group/twosample.pyx":85 * n1 = Y1.shape[axis] * n2 = Y2.shape[axis] * n = n1 + n2 # <<<<<<<<<<<<<< @@ -1048,20 +1433,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_n = (__pyx_v_n1 + __pyx_v_n2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":88 + /* "nipy/labs/group/twosample.pyx":88 * * # Read out magic numbers * if Magics == None: # <<<<<<<<<<<<<< * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":89 + /* "nipy/labs/group/twosample.pyx":89 * # Read out magic numbers * if Magics == None: * magics = fff_vector_new(1) # <<<<<<<<<<<<<< @@ -1070,19 +1454,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_magics = fff_vector_new(1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":90 + /* "nipy/labs/group/twosample.pyx":90 * if Magics == None: * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure # <<<<<<<<<<<<<< * else: * magics = fff_vector_fromPyArray(Magics) */ - (__pyx_v_magics->data[0]) = 0; - goto __pyx_L6; + (__pyx_v_magics->data[0]) = 0.0; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":92 + /* "nipy/labs/group/twosample.pyx":92 * magics.data[0] = 0 ## Just to make sure * else: * magics = fff_vector_fromPyArray(Magics) # <<<<<<<<<<<<<< @@ -1091,18 +1475,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_magics = fff_vector_fromPyArray(__pyx_v_Magics); } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":95 + /* "nipy/labs/group/twosample.pyx":95 * * # Create output array * nsimu = magics.size # <<<<<<<<<<<<<< * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu */ - __pyx_v_nsimu = __pyx_v_magics->size; + __pyx_t_5 = __pyx_v_magics->size; + __pyx_v_nsimu = __pyx_t_5; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":96 + /* "nipy/labs/group/twosample.pyx":96 * # Create output array * nsimu = magics.size * dims = [Y1.shape[i] for i in range(Y1.ndim)] # <<<<<<<<<<<<<< @@ -1110,92 +1495,58 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel * T = np.zeros(dims) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_Y1->nd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = 0; __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); - } else { - __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else { - __pyx_t_1 = PyIter_Next(__pyx_t_6); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y1->dimensions[__pyx_t_7])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_Y1->nd; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y1->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":97 + /* "nipy/labs/group/twosample.pyx":97 * nsimu = magics.size * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu # <<<<<<<<<<<<<< * T = np.zeros(dims) * */ - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_2, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":98 + /* "nipy/labs/group/twosample.pyx":98 * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu * T = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_T); - __pyx_v_T = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_T = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":101 + /* "nipy/labs/group/twosample.pyx":101 * * # Create local structure * yp = fff_vector_new(n) # <<<<<<<<<<<<<< @@ -1204,7 +1555,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_yp = fff_vector_new(__pyx_v_n); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":102 + /* "nipy/labs/group/twosample.pyx":102 * # Create local structure * yp = fff_vector_new(n) * idx1 = fff_array_new1d(FFF_UINT, n1) # <<<<<<<<<<<<<< @@ -1213,7 +1564,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_idx1 = fff_array_new1d(FFF_UINT, __pyx_v_n1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":103 + /* "nipy/labs/group/twosample.pyx":103 * yp = fff_vector_new(n) * idx1 = fff_array_new1d(FFF_UINT, n1) * idx2 = fff_array_new1d(FFF_UINT, n2) # <<<<<<<<<<<<<< @@ -1222,7 +1573,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_idx2 = fff_array_new1d(FFF_UINT, __pyx_v_n2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":104 + /* "nipy/labs/group/twosample.pyx":104 * idx1 = fff_array_new1d(FFF_UINT, n1) * idx2 = fff_array_new1d(FFF_UINT, n2) * stat = fff_twosample_stat_new(n1, n2, flag_stat) # <<<<<<<<<<<<<< @@ -1231,7 +1582,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_stat = fff_twosample_stat_new(__pyx_v_n1, __pyx_v_n2, __pyx_v_flag_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":107 + /* "nipy/labs/group/twosample.pyx":107 * * # Multi-iterator * multi = fffpy_multi_iterator_new(3, axis, Y1, Y2, T) # <<<<<<<<<<<<<< @@ -1240,7 +1591,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_multi = fffpy_multi_iterator_new(3, __pyx_v_axis, ((void *)__pyx_v_Y1), ((void *)__pyx_v_Y2), ((void *)__pyx_v_T)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":110 + /* "nipy/labs/group/twosample.pyx":110 * * # Vector views * y1 = multi.vector[0] # <<<<<<<<<<<<<< @@ -1249,7 +1600,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_y1 = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":111 + /* "nipy/labs/group/twosample.pyx":111 * # Vector views * y1 = multi.vector[0] * y2 = multi.vector[1] # <<<<<<<<<<<<<< @@ -1258,7 +1609,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_y2 = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":112 + /* "nipy/labs/group/twosample.pyx":112 * y1 = multi.vector[0] * y2 = multi.vector[1] * t = multi.vector[2] # <<<<<<<<<<<<<< @@ -1267,7 +1618,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_t = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":115 + /* "nipy/labs/group/twosample.pyx":115 * * # Loop * for simu from 0 <= simu < nsimu: # <<<<<<<<<<<<<< @@ -1277,7 +1628,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel __pyx_t_9 = __pyx_v_nsimu; for (__pyx_v_simu = 0; __pyx_v_simu < __pyx_t_9; __pyx_v_simu++) { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":118 + /* "nipy/labs/group/twosample.pyx":118 * * # Set the magic number * magic = magics.data[simu*magics.stride] # <<<<<<<<<<<<<< @@ -1286,7 +1637,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_magic = (__pyx_v_magics->data[(__pyx_v_simu * __pyx_v_magics->stride)]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":123 + /* "nipy/labs/group/twosample.pyx":123 * nex = fff_twosample_permutation(idx1.data, * idx2.data, * n1, n2, &magic) # <<<<<<<<<<<<<< @@ -1295,7 +1646,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_nex = fff_twosample_permutation(((unsigned int *)__pyx_v_idx1->data), ((unsigned int *)__pyx_v_idx2->data), __pyx_v_n1, __pyx_v_n2, (&__pyx_v_magic)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":126 + /* "nipy/labs/group/twosample.pyx":126 * * # Reset the multi-iterator * fffpy_multi_iterator_reset(multi) # <<<<<<<<<<<<<< @@ -1304,7 +1655,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fffpy_multi_iterator_reset(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":129 + /* "nipy/labs/group/twosample.pyx":129 * * # Perform the loop * idx = simu*t.stride # <<<<<<<<<<<<<< @@ -1313,7 +1664,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ __pyx_v_idx = (__pyx_v_simu * __pyx_v_t->stride); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":130 + /* "nipy/labs/group/twosample.pyx":130 * # Perform the loop * idx = simu*t.stride * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1324,7 +1675,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel __pyx_t_4 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_4) break; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":133 + /* "nipy/labs/group/twosample.pyx":133 * fff_twosample_apply_permutation(yp, NULL, y1, NULL, y2, NULL, nex, * idx1.data, * idx2.data) # <<<<<<<<<<<<<< @@ -1333,7 +1684,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_twosample_apply_permutation(__pyx_v_yp, NULL, __pyx_v_y1, NULL, __pyx_v_y2, NULL, __pyx_v_nex, ((unsigned int *)__pyx_v_idx1->data), ((unsigned int *)__pyx_v_idx2->data)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":134 + /* "nipy/labs/group/twosample.pyx":134 * idx1.data, * idx2.data) * t.data[idx] = fff_twosample_stat_eval(stat, yp) # <<<<<<<<<<<<<< @@ -1342,7 +1693,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ (__pyx_v_t->data[__pyx_v_idx]) = fff_twosample_stat_eval(__pyx_v_stat, __pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":135 + /* "nipy/labs/group/twosample.pyx":135 * idx2.data) * t.data[idx] = fff_twosample_stat_eval(stat, yp) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -1353,7 +1704,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel } } - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":138 + /* "nipy/labs/group/twosample.pyx":138 * * # Delete local structures * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -1362,7 +1713,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":139 + /* "nipy/labs/group/twosample.pyx":139 * # Delete local structures * fffpy_multi_iterator_delete(multi) * fff_vector_delete(magics) # <<<<<<<<<<<<<< @@ -1371,7 +1722,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_vector_delete(__pyx_v_magics); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":140 + /* "nipy/labs/group/twosample.pyx":140 * fffpy_multi_iterator_delete(multi) * fff_vector_delete(magics) * fff_vector_delete(yp) # <<<<<<<<<<<<<< @@ -1380,7 +1731,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_vector_delete(__pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":141 + /* "nipy/labs/group/twosample.pyx":141 * fff_vector_delete(magics) * fff_vector_delete(yp) * fff_array_delete(idx1) # <<<<<<<<<<<<<< @@ -1389,7 +1740,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_array_delete(__pyx_v_idx1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":142 + /* "nipy/labs/group/twosample.pyx":142 * fff_vector_delete(yp) * fff_array_delete(idx1) * fff_array_delete(idx2) # <<<<<<<<<<<<<< @@ -1398,7 +1749,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_array_delete(__pyx_v_idx2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":143 + /* "nipy/labs/group/twosample.pyx":143 * fff_array_delete(idx1) * fff_array_delete(idx2) * fff_twosample_stat_delete(stat) # <<<<<<<<<<<<<< @@ -1407,7 +1758,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel */ fff_twosample_stat_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":146 + /* "nipy/labs/group/twosample.pyx":146 * * # Return * return T # <<<<<<<<<<<<<< @@ -1424,33 +1775,22 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat(PyObject *__pyx_sel __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("nipy.labs.group.twosample.stat"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("nipy.labs.group.twosample.stat", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_T); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y1); - __Pyx_DECREF((PyObject *)__pyx_v_Y2); - __Pyx_DECREF(__pyx_v_id); - __Pyx_DECREF((PyObject *)__pyx_v_Magics); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_T); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":149 - * - * - * def stat_mfx(ndarray Y1, ndarray V1, ndarray Y2, ndarray V2, # <<<<<<<<<<<<<< - * id='student_mfx', int axis=0, ndarray Magics=None, - * unsigned int niter=5): - */ - -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_4nipy_4labs_5group_9twosample_stat_mfx[] = "\n T = stat(Y1, V1, Y2, V2, id='student', axis=0, magics=None, niter=5).\n \n Compute a two-sample test statistic (Y1>Y2) over a number of\n deterministic or random permutations.\n "; -static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +/* Python wrapper */ +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_5stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_4nipy_4labs_5group_9twosample_4stat_mfx[] = "\n T = stat(Y1, V1, Y2, V2, id='student', axis=0, magics=None, niter=5).\n \n Compute a two-sample test statistic (Y1>Y2) over a number of\n deterministic or random permutations.\n "; +static PyMethodDef __pyx_mdef_4nipy_4labs_5group_9twosample_5stat_mfx = {__Pyx_NAMESTR("stat_mfx"), (PyCFunction)__pyx_pw_4nipy_4labs_5group_9twosample_5stat_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9twosample_4stat_mfx)}; +static PyObject *__pyx_pw_4nipy_4labs_5group_9twosample_5stat_mfx(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_Y1 = 0; PyArrayObject *__pyx_v_V1 = 0; PyArrayObject *__pyx_v_Y2 = 0; @@ -1459,115 +1799,95 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx int __pyx_v_axis; PyArrayObject *__pyx_v_Magics = 0; unsigned int __pyx_v_niter; - fff_vector *__pyx_v_y1; - fff_vector *__pyx_v_y2; - fff_vector *__pyx_v_v1; - fff_vector *__pyx_v_v2; - fff_vector *__pyx_v_t; - fff_vector *__pyx_v_yp; - fff_vector *__pyx_v_vp; - fff_vector *__pyx_v_magics; - fff_array *__pyx_v_idx1; - fff_array *__pyx_v_idx2; - unsigned int __pyx_v_n; - unsigned int __pyx_v_n1; - unsigned int __pyx_v_n2; - unsigned int __pyx_v_nex; - unsigned long __pyx_v_simu; - unsigned long __pyx_v_nsimu; - unsigned long __pyx_v_idx; - fff_twosample_stat_mfx *__pyx_v_stat; - fff_twosample_stat_flag __pyx_v_flag_stat; - double __pyx_v_magic; - fffpy_multi_iterator *__pyx_v_multi; - PyObject *__pyx_v_dims; - PyObject *__pyx_v_T; - PyObject *__pyx_v_i; - PyObject *__pyx_r = NULL; - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - fff_twosample_stat_flag __pyx_t_3; - int __pyx_t_4; - Py_ssize_t __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - Py_ssize_t __pyx_t_7; - int __pyx_t_8; - unsigned long __pyx_t_9; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y1,&__pyx_n_s__V1,&__pyx_n_s__Y2,&__pyx_n_s__V2,&__pyx_n_s__id,&__pyx_n_s__axis,&__pyx_n_s__Magics,&__pyx_n_s__niter,0}; - __Pyx_RefNannySetupContext("stat_mfx"); - __pyx_self = __pyx_self; - if (unlikely(__pyx_kwds)) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("stat_mfx (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__Y1,&__pyx_n_s__V1,&__pyx_n_s__Y2,&__pyx_n_s__V2,&__pyx_n_s__id,&__pyx_n_s__axis,&__pyx_n_s__Magics,&__pyx_n_s__niter,0}; + PyObject* values[8] = {0,0,0,0,0,0,0,0}; + values[4] = ((PyObject *)__pyx_n_s__student_mfx); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":150 + /* "nipy/labs/group/twosample.pyx":150 * * def stat_mfx(ndarray Y1, ndarray V1, ndarray Y2, ndarray V2, * id='student_mfx', int axis=0, ndarray Magics=None, # <<<<<<<<<<<<<< * unsigned int niter=5): * """ */ - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[8] = {0,0,0,0,0,0,0,0}; - values[4] = ((PyObject *)__pyx_n_s__student_mfx); - values[6] = (PyObject*)((PyArrayObject *)Py_None); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y1); - if (likely(values[0])) kw_args--; - else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V1); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y2); - if (likely(values[2])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V2); - if (likely(values[3])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } - case 4: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); - if (unlikely(value)) { values[4] = value; kw_args--; } + values[6] = (PyObject *)((PyArrayObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; } - case 5: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); - if (unlikely(value)) { values[5] = value; kw_args--; } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y1)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V1)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Y2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__V2)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__id); + if (value) { values[4] = value; kw_args--; } + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__axis); + if (value) { values[5] = value; kw_args--; } + } + case 6: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); + if (value) { values[6] = value; kw_args--; } + } + case 7: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); + if (value) { values[7] = value; kw_args--; } + } } - case 6: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Magics); - if (unlikely(value)) { values[6] = value; kw_args--; } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "stat_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - case 7: - if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__niter); - if (unlikely(value)) { values[7] = value; kw_args--; } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; } } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "stat_mfx") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } __pyx_v_Y1 = ((PyArrayObject *)values[0]); __pyx_v_V1 = ((PyArrayObject *)values[1]); __pyx_v_Y2 = ((PyArrayObject *)values[2]); @@ -1584,52 +1904,79 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx } else { __pyx_v_niter = ((unsigned int)5); } - } else { - __pyx_v_id = ((PyObject *)__pyx_n_s__student_mfx); - __pyx_v_axis = ((int)0); - __pyx_v_Magics = ((PyArrayObject *)Py_None); - __pyx_v_niter = ((unsigned int)5); - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 8: - __pyx_v_niter = __Pyx_PyInt_AsUnsignedInt(PyTuple_GET_ITEM(__pyx_args, 7)); if (unlikely((__pyx_v_niter == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 7: - __pyx_v_Magics = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 6)); - case 6: - __pyx_v_axis = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 5)); if (unlikely((__pyx_v_axis == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 5: - __pyx_v_id = PyTuple_GET_ITEM(__pyx_args, 4); - case 4: - __pyx_v_V2 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 3)); - __pyx_v_Y2 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 2)); - __pyx_v_V1 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 1)); - __pyx_v_Y1 = ((PyArrayObject *)PyTuple_GET_ITEM(__pyx_args, 0)); - break; - default: goto __pyx_L5_argtuple_error; - } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("stat_mfx", 0, 4, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("nipy.labs.group.twosample.stat_mfx"); + __Pyx_AddTraceback("nipy.labs.group.twosample.stat_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF((PyObject *)__pyx_v_Y1); - __Pyx_INCREF((PyObject *)__pyx_v_V1); - __Pyx_INCREF((PyObject *)__pyx_v_Y2); - __Pyx_INCREF((PyObject *)__pyx_v_V2); - __Pyx_INCREF(__pyx_v_id); - __Pyx_INCREF((PyObject *)__pyx_v_Magics); - __pyx_v_dims = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_T = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y1), __pyx_ptype_5numpy_ndarray, 1, "Y1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V1), __pyx_ptype_5numpy_ndarray, 1, "V1", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Y2), __pyx_ptype_5numpy_ndarray, 1, "Y2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_V2), __pyx_ptype_5numpy_ndarray, 1, "V2", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Magics), __pyx_ptype_5numpy_ndarray, 1, "Magics", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_4nipy_4labs_5group_9twosample_4stat_mfx(__pyx_self, __pyx_v_Y1, __pyx_v_V1, __pyx_v_Y2, __pyx_v_V2, __pyx_v_id, __pyx_v_axis, __pyx_v_Magics, __pyx_v_niter); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "nipy/labs/group/twosample.pyx":149 + * + * + * def stat_mfx(ndarray Y1, ndarray V1, ndarray Y2, ndarray V2, # <<<<<<<<<<<<<< + * id='student_mfx', int axis=0, ndarray Magics=None, + * unsigned int niter=5): + */ + +static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_4stat_mfx(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_Y1, PyArrayObject *__pyx_v_V1, PyArrayObject *__pyx_v_Y2, PyArrayObject *__pyx_v_V2, PyObject *__pyx_v_id, int __pyx_v_axis, PyArrayObject *__pyx_v_Magics, unsigned int __pyx_v_niter) { + fff_vector *__pyx_v_y1; + fff_vector *__pyx_v_y2; + fff_vector *__pyx_v_v1; + fff_vector *__pyx_v_v2; + fff_vector *__pyx_v_t; + fff_vector *__pyx_v_yp; + fff_vector *__pyx_v_vp; + fff_vector *__pyx_v_magics; + fff_array *__pyx_v_idx1; + fff_array *__pyx_v_idx2; + unsigned int __pyx_v_n; + unsigned int __pyx_v_n1; + unsigned int __pyx_v_n2; + unsigned int __pyx_v_nex; + unsigned long __pyx_v_simu; + unsigned long __pyx_v_nsimu; + unsigned long __pyx_v_idx; + fff_twosample_stat_mfx *__pyx_v_stat; + fff_twosample_stat_flag __pyx_v_flag_stat; + double __pyx_v_magic; + fffpy_multi_iterator *__pyx_v_multi; + PyObject *__pyx_v_dims = NULL; + PyObject *__pyx_v_T = NULL; + int __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + fff_twosample_stat_flag __pyx_t_3; + int __pyx_t_4; + size_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + unsigned long __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stat_mfx", 0); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":163 + /* "nipy/labs/group/twosample.pyx":163 * cdef unsigned long int simu, nsimu, idx * cdef fff_twosample_stat_mfx* stat * cdef fff_twosample_stat_flag flag_stat = stats[id] # <<<<<<<<<<<<<< @@ -1645,7 +1992,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_flag_stat = __pyx_t_3; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":168 + /* "nipy/labs/group/twosample.pyx":168 * * # Get number of observations * n1 = Y1.shape[axis] # <<<<<<<<<<<<<< @@ -1654,7 +2001,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_n1 = ((unsigned int)(__pyx_v_Y1->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":169 + /* "nipy/labs/group/twosample.pyx":169 * # Get number of observations * n1 = Y1.shape[axis] * n2 = Y2.shape[axis] # <<<<<<<<<<<<<< @@ -1663,7 +2010,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_n2 = ((unsigned int)(__pyx_v_Y2->dimensions[__pyx_v_axis])); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":170 + /* "nipy/labs/group/twosample.pyx":170 * n1 = Y1.shape[axis] * n2 = Y2.shape[axis] * n = n1 + n2 # <<<<<<<<<<<<<< @@ -1672,20 +2019,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_n = (__pyx_v_n1 + __pyx_v_n2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":173 + /* "nipy/labs/group/twosample.pyx":173 * * # Read out magic numbers * if Magics == None: # <<<<<<<<<<<<<< * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure */ - __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = PyObject_RichCompare(((PyObject *)__pyx_v_Magics), Py_None, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":174 + /* "nipy/labs/group/twosample.pyx":174 * # Read out magic numbers * if Magics == None: * magics = fff_vector_new(1) # <<<<<<<<<<<<<< @@ -1694,19 +2040,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_magics = fff_vector_new(1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":175 + /* "nipy/labs/group/twosample.pyx":175 * if Magics == None: * magics = fff_vector_new(1) * magics.data[0] = 0 ## Just to make sure # <<<<<<<<<<<<<< * else: * magics = fff_vector_fromPyArray(Magics) */ - (__pyx_v_magics->data[0]) = 0; - goto __pyx_L6; + (__pyx_v_magics->data[0]) = 0.0; + goto __pyx_L3; } /*else*/ { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":177 + /* "nipy/labs/group/twosample.pyx":177 * magics.data[0] = 0 ## Just to make sure * else: * magics = fff_vector_fromPyArray(Magics) # <<<<<<<<<<<<<< @@ -1715,18 +2061,19 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_magics = fff_vector_fromPyArray(__pyx_v_Magics); } - __pyx_L6:; + __pyx_L3:; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":180 + /* "nipy/labs/group/twosample.pyx":180 * * # Create output array * nsimu = magics.size # <<<<<<<<<<<<<< * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu */ - __pyx_v_nsimu = __pyx_v_magics->size; + __pyx_t_5 = __pyx_v_magics->size; + __pyx_v_nsimu = __pyx_t_5; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":181 + /* "nipy/labs/group/twosample.pyx":181 * # Create output array * nsimu = magics.size * dims = [Y1.shape[i] for i in range(Y1.ndim)] # <<<<<<<<<<<<<< @@ -1734,92 +2081,58 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx * T = np.zeros(dims) */ __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_Y1->nd); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_5 = 0; __pyx_t_6 = __pyx_t_1; __Pyx_INCREF(__pyx_t_6); - } else { - __pyx_t_5 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - for (;;) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else if (likely(PyTuple_CheckExact(__pyx_t_6))) { - if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_5); __Pyx_INCREF(__pyx_t_1); __pyx_t_5++; - } else { - __pyx_t_1 = PyIter_Next(__pyx_t_6); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } - __Pyx_GOTREF(__pyx_t_1); - } - __Pyx_DECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; - __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_intp((__pyx_v_Y1->dimensions[__pyx_t_7])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __pyx_v_Y1->nd; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + __pyx_t_1 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_Y1->dimensions[__pyx_v_i])); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_8 = PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1); if (unlikely(__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_INCREF(((PyObject *)__pyx_t_2)); - __Pyx_DECREF(__pyx_v_dims); - __pyx_v_dims = ((PyObject *)__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_dims = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":182 + /* "nipy/labs/group/twosample.pyx":182 * nsimu = magics.size * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu # <<<<<<<<<<<<<< * T = np.zeros(dims) * */ - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(__pyx_v_dims, __pyx_v_axis, __pyx_t_2, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_nsimu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_dims), __pyx_v_axis, __pyx_t_1, sizeof(int), PyInt_FromLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":183 + /* "nipy/labs/group/twosample.pyx":183 * dims = [Y1.shape[i] for i in range(Y1.ndim)] * dims[axis] = nsimu * T = np.zeros(dims) # <<<<<<<<<<<<<< * * # Create local structure */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_dims); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_dims); - __Pyx_GIVEREF(__pyx_v_dims); - __pyx_t_1 = PyObject_Call(__pyx_t_6, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_dims)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dims)); + __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_T); - __pyx_v_T = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_T = __pyx_t_8; + __pyx_t_8 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":186 + /* "nipy/labs/group/twosample.pyx":186 * * # Create local structure * yp = fff_vector_new(n) # <<<<<<<<<<<<<< @@ -1828,7 +2141,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_yp = fff_vector_new(__pyx_v_n); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":187 + /* "nipy/labs/group/twosample.pyx":187 * # Create local structure * yp = fff_vector_new(n) * vp = fff_vector_new(n) # <<<<<<<<<<<<<< @@ -1837,7 +2150,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_vp = fff_vector_new(__pyx_v_n); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":188 + /* "nipy/labs/group/twosample.pyx":188 * yp = fff_vector_new(n) * vp = fff_vector_new(n) * idx1 = fff_array_new1d(FFF_UINT, n1) # <<<<<<<<<<<<<< @@ -1846,7 +2159,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_idx1 = fff_array_new1d(FFF_UINT, __pyx_v_n1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":189 + /* "nipy/labs/group/twosample.pyx":189 * vp = fff_vector_new(n) * idx1 = fff_array_new1d(FFF_UINT, n1) * idx2 = fff_array_new1d(FFF_UINT, n2) # <<<<<<<<<<<<<< @@ -1855,7 +2168,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_idx2 = fff_array_new1d(FFF_UINT, __pyx_v_n2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":190 + /* "nipy/labs/group/twosample.pyx":190 * idx1 = fff_array_new1d(FFF_UINT, n1) * idx2 = fff_array_new1d(FFF_UINT, n2) * stat = fff_twosample_stat_mfx_new(n1, n2, flag_stat) # <<<<<<<<<<<<<< @@ -1864,7 +2177,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_stat = fff_twosample_stat_mfx_new(__pyx_v_n1, __pyx_v_n2, __pyx_v_flag_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":191 + /* "nipy/labs/group/twosample.pyx":191 * idx2 = fff_array_new1d(FFF_UINT, n2) * stat = fff_twosample_stat_mfx_new(n1, n2, flag_stat) * stat.niter = niter # <<<<<<<<<<<<<< @@ -1873,7 +2186,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_stat->niter = __pyx_v_niter; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":197 + /* "nipy/labs/group/twosample.pyx":197 * Y1, V1, * Y2, V2, * T) # <<<<<<<<<<<<<< @@ -1882,7 +2195,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_multi = fffpy_multi_iterator_new(5, __pyx_v_axis, ((void *)__pyx_v_Y1), ((void *)__pyx_v_V1), ((void *)__pyx_v_Y2), ((void *)__pyx_v_V2), ((void *)__pyx_v_T)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":200 + /* "nipy/labs/group/twosample.pyx":200 * * # Vector views * y1 = multi.vector[0] # <<<<<<<<<<<<<< @@ -1891,7 +2204,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_y1 = (__pyx_v_multi->vector[0]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":201 + /* "nipy/labs/group/twosample.pyx":201 * # Vector views * y1 = multi.vector[0] * v1 = multi.vector[1] # <<<<<<<<<<<<<< @@ -1900,7 +2213,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_v1 = (__pyx_v_multi->vector[1]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":202 + /* "nipy/labs/group/twosample.pyx":202 * y1 = multi.vector[0] * v1 = multi.vector[1] * y2 = multi.vector[2] # <<<<<<<<<<<<<< @@ -1909,7 +2222,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_y2 = (__pyx_v_multi->vector[2]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":203 + /* "nipy/labs/group/twosample.pyx":203 * v1 = multi.vector[1] * y2 = multi.vector[2] * v2 = multi.vector[3] # <<<<<<<<<<<<<< @@ -1918,7 +2231,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_v2 = (__pyx_v_multi->vector[3]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":204 + /* "nipy/labs/group/twosample.pyx":204 * y2 = multi.vector[2] * v2 = multi.vector[3] * t = multi.vector[4] # <<<<<<<<<<<<<< @@ -1927,7 +2240,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_t = (__pyx_v_multi->vector[4]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":207 + /* "nipy/labs/group/twosample.pyx":207 * * # Loop * for simu from 0 <= simu < nsimu: # <<<<<<<<<<<<<< @@ -1937,7 +2250,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx __pyx_t_9 = __pyx_v_nsimu; for (__pyx_v_simu = 0; __pyx_v_simu < __pyx_t_9; __pyx_v_simu++) { - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":210 + /* "nipy/labs/group/twosample.pyx":210 * * # Set the magic number * magic = magics.data[simu*magics.stride] # <<<<<<<<<<<<<< @@ -1946,7 +2259,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_magic = (__pyx_v_magics->data[(__pyx_v_simu * __pyx_v_magics->stride)]); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":215 + /* "nipy/labs/group/twosample.pyx":215 * nex = fff_twosample_permutation(idx1.data, * idx2.data, * n1, n2, &magic) # <<<<<<<<<<<<<< @@ -1955,7 +2268,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_nex = fff_twosample_permutation(((unsigned int *)__pyx_v_idx1->data), ((unsigned int *)__pyx_v_idx2->data), __pyx_v_n1, __pyx_v_n2, (&__pyx_v_magic)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":218 + /* "nipy/labs/group/twosample.pyx":218 * * # Reset the multi-iterator * fffpy_multi_iterator_reset(multi) # <<<<<<<<<<<<<< @@ -1964,7 +2277,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fffpy_multi_iterator_reset(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":221 + /* "nipy/labs/group/twosample.pyx":221 * * # Perform the loop * idx = simu*t.stride # <<<<<<<<<<<<<< @@ -1973,7 +2286,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ __pyx_v_idx = (__pyx_v_simu * __pyx_v_t->stride); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":222 + /* "nipy/labs/group/twosample.pyx":222 * # Perform the loop * idx = simu*t.stride * while(multi.index < multi.size): # <<<<<<<<<<<<<< @@ -1984,7 +2297,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx __pyx_t_4 = (__pyx_v_multi->index < __pyx_v_multi->size); if (!__pyx_t_4) break; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":225 + /* "nipy/labs/group/twosample.pyx":225 * fff_twosample_apply_permutation(yp, vp, y1, v1, y2, v2, nex, * idx1.data, * idx2.data) # <<<<<<<<<<<<<< @@ -1993,7 +2306,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_twosample_apply_permutation(__pyx_v_yp, __pyx_v_vp, __pyx_v_y1, __pyx_v_v1, __pyx_v_y2, __pyx_v_v2, __pyx_v_nex, ((unsigned int *)__pyx_v_idx1->data), ((unsigned int *)__pyx_v_idx2->data)); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":226 + /* "nipy/labs/group/twosample.pyx":226 * idx1.data, * idx2.data) * t.data[idx] = fff_twosample_stat_mfx_eval(stat, yp, vp) # <<<<<<<<<<<<<< @@ -2002,7 +2315,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ (__pyx_v_t->data[__pyx_v_idx]) = fff_twosample_stat_mfx_eval(__pyx_v_stat, __pyx_v_yp, __pyx_v_vp); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":227 + /* "nipy/labs/group/twosample.pyx":227 * idx2.data) * t.data[idx] = fff_twosample_stat_mfx_eval(stat, yp, vp) * fffpy_multi_iterator_update(multi) # <<<<<<<<<<<<<< @@ -2013,7 +2326,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx } } - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":230 + /* "nipy/labs/group/twosample.pyx":230 * * # Delete local structures * fffpy_multi_iterator_delete(multi) # <<<<<<<<<<<<<< @@ -2022,7 +2335,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fffpy_multi_iterator_delete(__pyx_v_multi); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":231 + /* "nipy/labs/group/twosample.pyx":231 * # Delete local structures * fffpy_multi_iterator_delete(multi) * fff_vector_delete(magics) # <<<<<<<<<<<<<< @@ -2031,7 +2344,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_vector_delete(__pyx_v_magics); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":232 + /* "nipy/labs/group/twosample.pyx":232 * fffpy_multi_iterator_delete(multi) * fff_vector_delete(magics) * fff_vector_delete(yp) # <<<<<<<<<<<<<< @@ -2040,7 +2353,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_vector_delete(__pyx_v_yp); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":233 + /* "nipy/labs/group/twosample.pyx":233 * fff_vector_delete(magics) * fff_vector_delete(yp) * fff_vector_delete(vp) # <<<<<<<<<<<<<< @@ -2049,7 +2362,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_vector_delete(__pyx_v_vp); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":234 + /* "nipy/labs/group/twosample.pyx":234 * fff_vector_delete(yp) * fff_vector_delete(vp) * fff_array_delete(idx1) # <<<<<<<<<<<<<< @@ -2058,7 +2371,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_array_delete(__pyx_v_idx1); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":235 + /* "nipy/labs/group/twosample.pyx":235 * fff_vector_delete(vp) * fff_array_delete(idx1) * fff_array_delete(idx2) # <<<<<<<<<<<<<< @@ -2067,7 +2380,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_array_delete(__pyx_v_idx2); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":236 + /* "nipy/labs/group/twosample.pyx":236 * fff_array_delete(idx1) * fff_array_delete(idx2) * fff_twosample_stat_mfx_delete(stat) # <<<<<<<<<<<<<< @@ -2076,7 +2389,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx */ fff_twosample_stat_mfx_delete(__pyx_v_stat); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":239 + /* "nipy/labs/group/twosample.pyx":239 * * # Return * return T # <<<<<<<<<<<<<< @@ -2091,25 +2404,29 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("nipy.labs.group.twosample.stat_mfx"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("nipy.labs.group.twosample.stat_mfx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF(__pyx_v_dims); - __Pyx_DECREF(__pyx_v_T); - __Pyx_DECREF(__pyx_v_i); - __Pyx_DECREF((PyObject *)__pyx_v_Y1); - __Pyx_DECREF((PyObject *)__pyx_v_V1); - __Pyx_DECREF((PyObject *)__pyx_v_Y2); - __Pyx_DECREF((PyObject *)__pyx_v_V2); - __Pyx_DECREF(__pyx_v_id); - __Pyx_DECREF((PyObject *)__pyx_v_Magics); + __Pyx_XDECREF(__pyx_v_dims); + __Pyx_XDECREF(__pyx_v_T); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -2117,8 +2434,7 @@ static PyObject *__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx(PyObject *__pyx * # requirements, and does not yet fullfill the PEP. */ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; @@ -2130,23 +2446,42 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf int __pyx_v_offset; int __pyx_v_hasfields; int __pyx_r; + __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; - int __pyx_t_8; + PyObject *__pyx_t_8 = NULL; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); - if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); - __Pyx_GIVEREF(__pyx_v_info->obj); - __Pyx_INCREF((PyObject *)__pyx_v_self); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":193 + /* "numpy.pxd":200 * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< * cdef bint little_endian = ((&endian_detector)[0] != 0) @@ -2154,7 +2489,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":194 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2163,16 +2498,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":196 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":198 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2182,7 +2517,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":199 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -2190,11 +2525,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf * copy_shape = 0 */ __pyx_v_copy_shape = 1; - goto __pyx_L5; + goto __pyx_L4; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":201 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -2203,9 +2538,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_copy_shape = 0; } - __pyx_L5:; + __pyx_L4:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":203 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2215,43 +2550,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":204 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; } if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":205 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; } - __pyx_L6:; + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":207 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -2261,142 +2590,135 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":208 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; } if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":209 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L7; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L7:; + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":211 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim * if copy_shape: */ - __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":212 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< * if copy_shape: - * # Allocate new buffer for strides and shape info. This is allocated + * # Allocate new buffer for strides and shape info. */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":213 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + if (__pyx_v_copy_shape) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":216 - * # Allocate new buffer for strides and shape info. This is allocated - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< * info.shape = info.strides + ndim * for i in range(ndim): */ - __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":217 - * # as one block, strides first. - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":218 - * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":219 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< * info.shape[i] = PyArray_DIMS(self)[i] * else: */ - (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":220 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< * else: * info.strides = PyArray_STRIDES(self) */ - (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); } - goto __pyx_L8; + goto __pyx_L7; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":222 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL */ - __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":223 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) */ - __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); } - __pyx_L8:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":224 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -2405,25 +2727,25 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":225 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< * info.readonly = not PyArray_ISWRITEABLE(self) * */ - __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":226 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":229 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -2432,17 +2754,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":230 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); - __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":234 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -2451,7 +2775,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":236 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -2467,7 +2791,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":238 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -2479,49 +2803,50 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; - goto __pyx_L11; + goto __pyx_L10; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":241 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - __Pyx_INCREF(__pyx_v_self); - __Pyx_GIVEREF(__pyx_v_self); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); __Pyx_GOTREF(__pyx_v_info->obj); __Pyx_DECREF(__pyx_v_info->obj); - __pyx_v_info->obj = __pyx_v_self; + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); } - __pyx_L11:; + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":243 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":244 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":245 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -2532,50 +2857,44 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf } if (!__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":246 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_7 = __pyx_t_3; } else { - __pyx_t_8 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - __pyx_t_1 = __pyx_t_8; + __pyx_t_1 = __pyx_t_7; } else { __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":247 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L13; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L13:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":248 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -2584,10 +2903,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_BYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__b; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":249 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -2597,10 +2916,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__B; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":250 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -2610,10 +2929,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_SHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__h; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":251 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -2623,10 +2942,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_USHORT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__H; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":252 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -2636,10 +2955,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_INT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__i; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":253 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -2649,10 +2968,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_UINT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__I; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":254 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -2662,10 +2981,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__l; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":255 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -2675,10 +2994,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__L; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":256 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -2688,10 +3007,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":257 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -2701,10 +3020,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Q; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":258 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -2714,10 +3033,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__f; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":259 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -2727,10 +3046,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__d; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":260 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -2740,10 +3059,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__g; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":261 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2753,10 +3072,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zf; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":262 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2766,10 +3085,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zd; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":263 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2779,10 +3098,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); if (__pyx_t_1) { __pyx_v_f = __pyx_k__Zg; - goto __pyx_L14; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":264 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2792,37 +3111,37 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); if (__pyx_t_1) { __pyx_v_f = __pyx_k__O; - goto __pyx_L14; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":266 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L14:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":267 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2831,7 +3150,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":268 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2840,105 +3159,114 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_v_self, Py_buf */ __pyx_r = 0; goto __pyx_L0; - goto __pyx_L12; + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":270 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":271 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":272 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":275 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":276 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } - __pyx_L12:; + __pyx_L11:; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; - __Pyx_GOTREF(__pyx_v_info->obj); - __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } goto __pyx_L2; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { __Pyx_GOTREF(Py_None); __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; } __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":278 - * f[0] = 0 # Terminate format string +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): * stdlib.free(info.format) */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); - __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":279 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":280 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2946,11 +3274,11 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * stdlib.free(info.strides) */ free(__pyx_v_info->format); - goto __pyx_L5; + goto __pyx_L3; } - __pyx_L5:; + __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":281 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2960,7 +3288,7 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":282 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2968,15 +3296,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P * */ free(__pyx_v_info->strides); - goto __pyx_L6; + goto __pyx_L4; } - __pyx_L6:; + __pyx_L4:; - __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":755 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2986,10 +3313,14 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, P static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":756 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2997,7 +3328,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3007,7 +3338,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3015,7 +3346,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":758 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -3025,10 +3356,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":759 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -3036,7 +3371,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3046,7 +3381,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3054,7 +3389,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":761 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -3064,10 +3399,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":762 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -3075,7 +3414,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3085,7 +3424,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3093,7 +3432,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":764 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -3103,10 +3442,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":765 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -3114,7 +3457,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3124,7 +3467,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3132,7 +3475,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":767 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -3142,10 +3485,14 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":768 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -3153,7 +3500,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3163,7 +3510,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3171,7 +3518,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":770 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -3180,33 +3527,33 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ */ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { - PyArray_Descr *__pyx_v_child; + PyArray_Descr *__pyx_v_child = 0; int __pyx_v_endian_detector; int __pyx_v_little_endian; - PyObject *__pyx_v_fields; - PyObject *__pyx_v_childname; - PyObject *__pyx_v_new_offset; - PyObject *__pyx_v_t; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; char *__pyx_r; - Py_ssize_t __pyx_t_1; - PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); - __Pyx_INCREF((PyObject *)__pyx_v_descr); - __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); - __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); - __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":777 + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3215,7 +3562,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":778 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3224,167 +3571,194 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":781 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< * fields = descr.fields[childname] * child, new_offset = fields */ - if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { - __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); - } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { - if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; - __Pyx_DECREF(__pyx_v_childname); + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":782 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject *)__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":783 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< * * if (end - f) - (new_offset - offset[0]) < 15: */ - if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { - PyObject* tuple = ((PyObject *)__pyx_v_fields); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; - __pyx_t_4 = 0; - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":785 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":786 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":788 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":789 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":790 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":800 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -3392,16 +3766,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":801 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -3410,469 +3783,448 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":802 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< * offset[0] += 1 * */ - __pyx_v_f += 1; + __pyx_v_f = (__pyx_v_f + 1); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":803 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - (__pyx_v_offset[0]) += 1; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":805 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - (__pyx_v_offset[0]) += __pyx_v_child->elsize; + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":807 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":808 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_v_t); + __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":809 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":810 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":813 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":814 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":815 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":816 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":817 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":818 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":819 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":820 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":821 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":822 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":823 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":824 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":825 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":826 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":827 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":828 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - goto __pyx_L11; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":829 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":831 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":832 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< * else: * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 1; - goto __pyx_L9; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":836 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_10; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":837 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3885,24 +4237,23 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("numpy._util_dtypestring"); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_child); - __Pyx_DECREF(__pyx_v_fields); - __Pyx_DECREF(__pyx_v_childname); - __Pyx_DECREF(__pyx_v_new_offset); - __Pyx_DECREF(__pyx_v_t); - __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":952 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3912,12 +4263,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); + __Pyx_RefNannySetupContext("set_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":954 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3927,7 +4277,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":955 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3939,7 +4289,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":957 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3948,7 +4298,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":958 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3959,7 +4309,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":959 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3968,7 +4318,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":960 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3977,12 +4327,10 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ __pyx_v_arr->base = __pyx_v_baseptr; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); __Pyx_RefNannyFinishContext(); } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":962 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3992,11 +4340,11 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_RefNannySetupContext("get_array_base", 0); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":963 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -4006,7 +4354,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":964 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -4021,7 +4369,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":966 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -4035,26 +4383,20 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_r = Py_None; __Pyx_INCREF(Py_None); __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("count_permutations"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9twosample_count_permutations, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("stat"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9twosample_stat, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9twosample_stat)}, - {__Pyx_NAMESTR("stat_mfx"), (PyCFunction)__pyx_pf_4nipy_4labs_5group_9twosample_stat_mfx, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_4nipy_4labs_5group_9twosample_stat_mfx)}, +static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; -static void __pyx_init_filenames(void); /*proto*/ - #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("twosample"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_13), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -4066,62 +4408,382 @@ static struct PyModuleDef __pyx_moduledef = { static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, - {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, {&__pyx_n_s__Magics, __pyx_k__Magics, sizeof(__pyx_k__Magics), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, {&__pyx_n_s__V1, __pyx_k__V1, sizeof(__pyx_k__V1), 0, 0, 1, 1}, {&__pyx_n_s__V2, __pyx_k__V2, sizeof(__pyx_k__V2), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s__Y1, __pyx_k__Y1, sizeof(__pyx_k__Y1), 0, 0, 1, 1}, {&__pyx_n_s__Y2, __pyx_k__Y2, sizeof(__pyx_k__Y2), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, - {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, - {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, - {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, - {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, - {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, - {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__count_permutations, __pyx_k__count_permutations, sizeof(__pyx_k__count_permutations), 0, 0, 1, 1}, + {&__pyx_n_s__dims, __pyx_k__dims, sizeof(__pyx_k__dims), 0, 0, 1, 1}, + {&__pyx_n_s__flag_stat, __pyx_k__flag_stat, sizeof(__pyx_k__flag_stat), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, {&__pyx_n_s__id, __pyx_k__id, sizeof(__pyx_k__id), 0, 0, 1, 1}, - {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, - {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__idx, __pyx_k__idx, sizeof(__pyx_k__idx), 0, 0, 1, 1}, + {&__pyx_n_s__idx1, __pyx_k__idx1, sizeof(__pyx_k__idx1), 0, 0, 1, 1}, + {&__pyx_n_s__idx2, __pyx_k__idx2, sizeof(__pyx_k__idx2), 0, 0, 1, 1}, + {&__pyx_n_s__magic, __pyx_k__magic, sizeof(__pyx_k__magic), 0, 0, 1, 1}, + {&__pyx_n_s__magics, __pyx_k__magics, sizeof(__pyx_k__magics), 0, 0, 1, 1}, + {&__pyx_n_s__multi, __pyx_k__multi, sizeof(__pyx_k__multi), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, {&__pyx_n_s__n1, __pyx_k__n1, sizeof(__pyx_k__n1), 0, 0, 1, 1}, {&__pyx_n_s__n2, __pyx_k__n2, sizeof(__pyx_k__n2), 0, 0, 1, 1}, - {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, - {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__nex, __pyx_k__nex, sizeof(__pyx_k__nex), 0, 0, 1, 1}, {&__pyx_n_s__niter, __pyx_k__niter, sizeof(__pyx_k__niter), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__nsimu, __pyx_k__nsimu, sizeof(__pyx_k__nsimu), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, - {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, - {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, - {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, - {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__simu, __pyx_k__simu, sizeof(__pyx_k__simu), 0, 0, 1, 1}, + {&__pyx_n_s__stat, __pyx_k__stat, sizeof(__pyx_k__stat), 0, 0, 1, 1}, + {&__pyx_n_s__stat_mfx, __pyx_k__stat_mfx, sizeof(__pyx_k__stat_mfx), 0, 0, 1, 1}, {&__pyx_n_s__stats, __pyx_k__stats, sizeof(__pyx_k__stats), 0, 0, 1, 1}, - {&__pyx_n_s__stride, __pyx_k__stride, sizeof(__pyx_k__stride), 0, 0, 1, 1}, - {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, {&__pyx_n_s__student, __pyx_k__student, sizeof(__pyx_k__student), 0, 0, 1, 1}, {&__pyx_n_s__student_mfx, __pyx_k__student_mfx, sizeof(__pyx_k__student_mfx), 0, 0, 1, 1}, - {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, - {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, - {&__pyx_n_s__vector, __pyx_k__vector, sizeof(__pyx_k__vector), 0, 0, 1, 1}, + {&__pyx_n_s__t, __pyx_k__t, sizeof(__pyx_k__t), 0, 0, 1, 1}, + {&__pyx_n_s__v1, __pyx_k__v1, sizeof(__pyx_k__v1), 0, 0, 1, 1}, + {&__pyx_n_s__v2, __pyx_k__v2, sizeof(__pyx_k__v2), 0, 0, 1, 1}, + {&__pyx_n_s__vp, __pyx_k__vp, sizeof(__pyx_k__vp), 0, 0, 1, 1}, {&__pyx_n_s__wilcoxon, __pyx_k__wilcoxon, sizeof(__pyx_k__wilcoxon), 0, 0, 1, 1}, + {&__pyx_n_s__y1, __pyx_k__y1, sizeof(__pyx_k__y1), 0, 0, 1, 1}, + {&__pyx_n_s__y2, __pyx_k__y2, sizeof(__pyx_k__y2), 0, 0, 1, 1}, + {&__pyx_n_s__yp, __pyx_k__yp, sizeof(__pyx_k__yp), 0, 0, 1, 1}, {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_9); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "nipy/labs/group/twosample.pyx":60 + * + * + * def count_permutations(unsigned int n1, unsigned int n2): # <<<<<<<<<<<<<< + * cdef double n + * fff_twosample_permutation(NULL, NULL, n1, n2, &n) + */ + __pyx_k_tuple_15 = PyTuple_New(3); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n1)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 0, ((PyObject *)__pyx_n_s__n1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n2)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 1, ((PyObject *)__pyx_n_s__n2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_15, 2, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + __pyx_k_codeobj_16 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_15, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__count_permutations, 60, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/twosample.pyx":66 + * + * + * def stat(ndarray Y1, ndarray Y2, id='student', int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< + * """ + * T = stat(Y1, Y2, id='student', axis=0, magics=None). + */ + __pyx_k_tuple_19 = PyTuple_New(26); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_n_s__Y1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 1, ((PyObject *)__pyx_n_s__Y2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__id)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 2, ((PyObject *)__pyx_n_s__id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 3, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 4, ((PyObject *)__pyx_n_s__Magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 5, ((PyObject *)__pyx_n_s__y1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 6, ((PyObject *)__pyx_n_s__y2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 7, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__yp)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 8, ((PyObject *)__pyx_n_s__yp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 9, ((PyObject *)__pyx_n_s__magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 10, ((PyObject *)__pyx_n_s__idx1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 11, ((PyObject *)__pyx_n_s__idx2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 12, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n1)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 13, ((PyObject *)__pyx_n_s__n1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n2)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 14, ((PyObject *)__pyx_n_s__n2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nex)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 15, ((PyObject *)__pyx_n_s__nex)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nex)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__simu)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 16, ((PyObject *)__pyx_n_s__simu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__simu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nsimu)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 17, ((PyObject *)__pyx_n_s__nsimu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsimu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 18, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 19, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag_stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 20, ((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magic)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 21, ((PyObject *)__pyx_n_s__magic)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magic)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 22, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 23, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 24, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_19, 25, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_codeobj_20 = (PyObject*)__Pyx_PyCode_New(5, 0, 26, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__stat, 66, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "nipy/labs/group/twosample.pyx":149 + * + * + * def stat_mfx(ndarray Y1, ndarray V1, ndarray Y2, ndarray V2, # <<<<<<<<<<<<<< + * id='student_mfx', int axis=0, ndarray Magics=None, + * unsigned int niter=5): + */ + __pyx_k_tuple_21 = PyTuple_New(32); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 0, ((PyObject *)__pyx_n_s__Y1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__V1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 1, ((PyObject *)__pyx_n_s__V1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__V1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Y2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 2, ((PyObject *)__pyx_n_s__Y2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Y2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__V2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 3, ((PyObject *)__pyx_n_s__V2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__V2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__id)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 4, ((PyObject *)__pyx_n_s__id)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__id)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__axis)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 5, ((PyObject *)__pyx_n_s__axis)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__axis)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__Magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 6, ((PyObject *)__pyx_n_s__Magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__Magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__niter)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 7, ((PyObject *)__pyx_n_s__niter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__niter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 8, ((PyObject *)__pyx_n_s__y1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__y2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 9, ((PyObject *)__pyx_n_s__y2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__y2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 10, ((PyObject *)__pyx_n_s__v1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__v2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 11, ((PyObject *)__pyx_n_s__v2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__v2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__t)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 12, ((PyObject *)__pyx_n_s__t)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__t)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__yp)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 13, ((PyObject *)__pyx_n_s__yp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__yp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__vp)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 14, ((PyObject *)__pyx_n_s__vp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__vp)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magics)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 15, ((PyObject *)__pyx_n_s__magics)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magics)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 16, ((PyObject *)__pyx_n_s__idx1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 17, ((PyObject *)__pyx_n_s__idx2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 18, ((PyObject *)__pyx_n_s__n)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n1)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 19, ((PyObject *)__pyx_n_s__n1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__n2)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 20, ((PyObject *)__pyx_n_s__n2)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__n2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nex)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 21, ((PyObject *)__pyx_n_s__nex)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nex)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__simu)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 22, ((PyObject *)__pyx_n_s__simu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__simu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__nsimu)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 23, ((PyObject *)__pyx_n_s__nsimu)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__nsimu)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__idx)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 24, ((PyObject *)__pyx_n_s__idx)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__idx)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 25, ((PyObject *)__pyx_n_s__stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__flag_stat)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 26, ((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__flag_stat)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__magic)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 27, ((PyObject *)__pyx_n_s__magic)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__magic)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__multi)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 28, ((PyObject *)__pyx_n_s__multi)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__multi)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__dims)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 29, ((PyObject *)__pyx_n_s__dims)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__dims)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__T)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 30, ((PyObject *)__pyx_n_s__T)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__T)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i)); + PyTuple_SET_ITEM(__pyx_k_tuple_21, 31, ((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __pyx_k_codeobj_22 = (PyObject*)__Pyx_PyCode_New(8, 0, 32, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_17, __pyx_n_s__stat_mfx, 149, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); return -1; } @@ -4143,8 +4805,8 @@ PyMODINIT_FUNC PyInit_twosample(void) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); @@ -4152,14 +4814,19 @@ PyMODINIT_FUNC PyInit_twosample(void) if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_twosample(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_twosample(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #if PY_MAJOR_VERSION < 3 - __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - #else __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ @@ -4170,16 +4837,23 @@ PyMODINIT_FUNC PyInit_twosample(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("twosample"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("twosample"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.group.twosample")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.group.twosample", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4188,28 +4862,39 @@ PyMODINIT_FUNC PyInit_twosample(void) } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":9 + /* "nipy/labs/group/twosample.pyx":9 * """ * * __version__ = '0.1' # <<<<<<<<<<<<<< * * */ - if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_14)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":49 + /* "nipy/labs/group/twosample.pyx":49 * * # Initialize numpy * fffpy_import_array() # <<<<<<<<<<<<<< @@ -4218,7 +4903,7 @@ PyMODINIT_FUNC PyInit_twosample(void) */ fffpy_import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":50 + /* "nipy/labs/group/twosample.pyx":50 * # Initialize numpy * fffpy_import_array() * import_array() # <<<<<<<<<<<<<< @@ -4227,19 +4912,19 @@ PyMODINIT_FUNC PyInit_twosample(void) */ import_array(); - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":51 + /* "nipy/labs/group/twosample.pyx":51 * fffpy_import_array() * import_array() * import numpy as np # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":55 + /* "nipy/labs/group/twosample.pyx":55 * * # Stat dictionary * stats = {'student': FFF_TWOSAMPLE_STUDENT, # <<<<<<<<<<<<<< @@ -4253,7 +4938,7 @@ PyMODINIT_FUNC PyInit_twosample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__student), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":56 + /* "nipy/labs/group/twosample.pyx":56 * # Stat dictionary * stats = {'student': FFF_TWOSAMPLE_STUDENT, * 'wilcoxon': FFF_TWOSAMPLE_WILCOXON, # <<<<<<<<<<<<<< @@ -4265,7 +4950,7 @@ PyMODINIT_FUNC PyInit_twosample(void) if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__wilcoxon), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/alexis/git/nipy/nipy/labs/group/twosample.pyx":57 + /* "nipy/labs/group/twosample.pyx":57 * stats = {'student': FFF_TWOSAMPLE_STUDENT, * 'wilcoxon': FFF_TWOSAMPLE_WILCOXON, * 'student_mfx': FFF_TWOSAMPLE_STUDENT_MFX} # <<<<<<<<<<<<<< @@ -4279,17 +4964,65 @@ PyMODINIT_FUNC PyInit_twosample(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stats, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/python_ref.pxd":1 - * cdef extern from "Python.h": # <<<<<<<<<<<<<< - * ctypedef struct PyTypeObject - * ctypedef struct PyObject: + /* "nipy/labs/group/twosample.pyx":60 + * + * + * def count_permutations(unsigned int n1, unsigned int n2): # <<<<<<<<<<<<<< + * cdef double n + * fff_twosample_permutation(NULL, NULL, n1, n2, &n) + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9twosample_1count_permutations, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__count_permutations, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/twosample.pyx":66 + * + * + * def stat(ndarray Y1, ndarray Y2, id='student', int axis=0, ndarray Magics=None): # <<<<<<<<<<<<<< + * """ + * T = stat(Y1, Y2, id='student', axis=0, magics=None). + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9twosample_3stat, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stat, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/twosample.pyx":149 + * + * + * def stat_mfx(ndarray Y1, ndarray V1, ndarray Y2, ndarray V2, # <<<<<<<<<<<<<< + * id='student_mfx', int axis=0, ndarray Magics=None, + * unsigned int niter=5): + */ + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_4nipy_4labs_5group_9twosample_5stat_mfx, NULL, __pyx_n_s_18); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__stat_mfx, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "nipy/labs/group/twosample.pyx":1 + * # -*- Mode: Python -*- Not really, but the syntax is close enough # <<<<<<<<<<<<<< + * """ + * Routines for massively univariate random-effect and mixed-effect + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None */ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init nipy.labs.group.twosample"); + __Pyx_AddTraceback("init nipy.labs.group.twosample", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init nipy.labs.group.twosample"); @@ -4303,28 +5036,36 @@ PyMODINIT_FUNC PyInit_twosample(void) #endif } -static const char *__pyx_filenames[] = { - "twosample.pyx", - "numpy.pxd", -}; - /* Runtime support code */ - -static void __pyx_init_filenames(void) { - __pyx_f = __pyx_filenames; +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; } +#endif /* CYTHON_REFNANNY */ -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, - PyObject* kw_name) -{ - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION >= 3 - "%s() got multiple values for keyword argument '%U'", func_name, kw_name); - #else - "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); - #endif +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { + PyObject *result; + result = PyObject_GetAttr(dict, name); + if (!result) { + if (dict != __pyx_b) { + PyErr_Clear(); + result = PyObject_GetAttr(__pyx_b, name); + } + if (!result) { + PyErr_SetObject(PyExc_NameError, name); + } + } + return result; } static void __Pyx_RaiseArgtupleInvalid( @@ -4335,8 +5076,7 @@ static void __Pyx_RaiseArgtupleInvalid( Py_ssize_t num_found) { Py_ssize_t num_expected; - const char *number, *more_or_less; - + const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; @@ -4347,14 +5087,23 @@ static void __Pyx_RaiseArgtupleInvalid( if (exact) { more_or_less = "exactly"; } - number = (num_expected == 1) ? "" : "s"; PyErr_Format(PyExc_TypeError, - #if PY_VERSION_HEX < 0x02050000 - "%s() takes %s %d positional argument%s (%d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else - "%s() takes %s %zd positional argument%s (%zd given)", + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); #endif - func_name, more_or_less, num_expected, number, num_found); } static int __Pyx_ParseOptionalKeywords( @@ -4369,55 +5118,77 @@ static int __Pyx_ParseOptionalKeywords( Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; - while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - /* unexpected keyword found */ - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; } + name++; } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -4436,42 +5207,265 @@ static int __Pyx_ParseOptionalKeywords( return -1; } +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { - PyErr_Format(PyExc_ValueError, +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; #if PY_VERSION_HEX < 0x02050000 - "need more than %d value%s to unpack", (int)index, + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } + else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } #else - "need more than %zd value%s to unpack", index, + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } #endif - (index == 1) ? "" : "s"); + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause && cause != Py_None) { + PyObject *fixed_cause; + if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } + else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } + else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; } +#endif -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - __Pyx_RaiseNeedMoreValuesError(index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; } } - return item; + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif } -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - __Pyx_RaiseTooManyValuesError(); +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); return -1; + } else { + return __Pyx_IterFinish(); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -4486,49 +5480,15 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { return 0; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); -} - -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); - } else { - __Pyx_RaiseTooManyValuesError(); - } -} - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact) -{ - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (none_allowed && obj == Py_None) return 1; - else if (exact) { - if (Py_TYPE(obj) == type) return 1; - } - else { - if (PyObject_TypeCheck(obj, type)) return 1; - } - PyErr_Format(PyExc_TypeError, - "Argument '%s' has incorrect type (expected %s, got %s)", - name, type->tp_name, Py_TYPE(obj)->tp_name); - return 0; -} - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { - PyObject *__import__ = 0; +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { + PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); - if (!__import__) + py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); + if (!py_import) goto bad; if (from_list) list = from_list; @@ -4544,38 +5504,73 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunctionObjArgs(__import__, + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); + #endif bad: Py_XDECREF(empty_list); - Py_XDECREF(__import__); + Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { - PyObject *result; - result = PyObject_GetAttr(dict, name); - if (!result) - PyErr_SetObject(PyExc_NameError, name); - return result; -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_Py_intptr_t(Py_intptr_t val) { + const Py_intptr_t neg_one = (Py_intptr_t)-1, const_zero = (Py_intptr_t)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(Py_intptr_t) == sizeof(char)) || + (sizeof(Py_intptr_t) == sizeof(short))) { return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { + } else if ((sizeof(Py_intptr_t) == sizeof(int)) || + (sizeof(Py_intptr_t) == sizeof(long))) { if (is_unsigned) return PyLong_FromUnsignedLong((unsigned long)val); else return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ + } else if (sizeof(Py_intptr_t) == sizeof(PY_LONG_LONG)) { if (is_unsigned) return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); else return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t), + little, !is_unsigned); } } @@ -4643,15 +5638,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { -#if HAVE_HYPOT - return hypotf(z.real, z.imag); -#else - return sqrtf(z.real*z.real + z.imag*z.imag); -#endif - } -*/ + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif #endif #if CYTHON_CCOMPLEX @@ -4718,152 +5758,60 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { z.imag = -a.imag; return z; } -/* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { -#if HAVE_HYPOT - return hypot(z.real, z.imag); -#else - return sqrt(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif - -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) - #else - if (!PyType_Check(type)) - #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif } - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } - else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } } - #else - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); } - #endif - } - - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} - -#else /* Python 3+ */ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - - PyErr_SetObject(type, value); - - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; } - } - -bad: - return; -} + #endif #endif static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { @@ -5037,6 +5985,25 @@ static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { return (signed int)__Pyx_PyInt_AsSignedLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; @@ -5058,9 +6025,9 @@ static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { "can't convert negative value to unsigned long"); return (unsigned long)-1; } - return PyLong_AsUnsignedLong(x); + return (unsigned long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; @@ -5093,9 +6060,9 @@ static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObje "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; @@ -5128,9 +6095,9 @@ static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { "can't convert negative value to long"); return (long)-1; } - return PyLong_AsUnsignedLong(x); + return (long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (long)PyLong_AsLong(x); } } else { long val; @@ -5163,9 +6130,9 @@ static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; @@ -5198,9 +6165,9 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { "can't convert negative value to signed long"); return (signed long)-1; } - return PyLong_AsUnsignedLong(x); + return (signed long)PyLong_AsUnsignedLong(x); } else { - return PyLong_AsLong(x); + return (signed long)PyLong_AsLong(x); } } else { signed long val; @@ -5233,9 +6200,9 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } - return PyLong_AsUnsignedLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { - return PyLong_AsLongLong(x); + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; @@ -5247,24 +6214,55 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + size_t size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; char warning[200]; - py_module = __Pyx_ImportModule(module_name); if (!py_module) goto bad; - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(class_name); - #else - py_name = PyUnicode_FromString(class_name); - #endif + py_name = __Pyx_PyIdentifier_FromString(class_name); if (!py_name) goto bad; result = PyObject_GetAttr(py_module, py_name); @@ -5275,19 +6273,23 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class if (!result) goto bad; if (!PyType_Check(result)) { - PyErr_Format(PyExc_TypeError, + PyErr_Format(PyExc_TypeError, "%s.%s is not a type object", module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), + if (!strict && (size_t)((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif } - else if (((PyTypeObject *)result)->tp_basicsize != size) { - PyErr_Format(PyExc_ValueError, + else if ((size_t)((PyTypeObject *)result)->tp_basicsize != size) { + PyErr_Format(PyExc_ValueError, "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; @@ -5296,54 +6298,109 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class bad: Py_XDECREF(py_module); Py_XDECREF(result); - return 0; + return NULL; } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - - #if PY_MAJOR_VERSION < 3 - py_name = PyString_FromString(name); - #else - py_name = PyUnicode_FromString(name); - #endif - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); } -#endif #include "compile.h" #include "frameobject.h" #include "traceback.h" - -static void __Pyx_AddTraceback(const char *funcname) { +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; PyObject *py_srcfile = 0; PyObject *py_funcname = 0; - PyObject *py_globals = 0; - PyCodeObject *py_code = 0; - PyFrameObject *py_frame = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(__pyx_filename); + py_srcfile = PyString_FromString(filename); #else - py_srcfile = PyUnicode_FromString(__pyx_filename); + py_srcfile = PyUnicode_FromString(filename); #endif if (!py_srcfile) goto bad; - if (__pyx_clineno) { + if (c_line) { #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); #endif } else { @@ -5354,28 +6411,45 @@ static void __Pyx_AddTraceback(const char *funcname) { #endif } if (!py_funcname) goto bad; - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_code = PyCode_New( + py_code = __Pyx_PyCode_New( 0, /*int argcount,*/ - #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ - #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ - __pyx_lineno, /*int firstlineno,*/ + py_line, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); - if (!py_code) goto bad; + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ @@ -5383,11 +6457,9 @@ static void __Pyx_AddTraceback(const char *funcname) { 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; - py_frame->f_lineno = __pyx_lineno; + py_frame->f_lineno = py_line; PyTraceBack_Here(py_frame); bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -5422,11 +6494,12 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { return 0; } + /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { - if (x == Py_True) return 1; - else if ((x == Py_False) | (x == Py_None)) return 0; + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } diff --git a/nipy/labs/utils/routines.c b/nipy/labs/utils/routines.c index bca2db41ce..35264ab986 100644 --- a/nipy/labs/utils/routines.c +++ b/nipy/labs/utils/routines.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.16.beta0 on Sun Jul 1 05:34:36 2012 */ +/* Generated by Cython 0.17.4 on Sat Jan 12 17:27:40 2013 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -11,7 +11,6 @@ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -23,33 +22,47 @@ #define __fastcall #endif #endif - #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif - +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) - #define PyNumber_Index(o) PyNumber_Int(o) - #define PyIndex_Check(o) PyNumber_Check(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #define __PYX_BUILD_PY_SSIZE_T "i" #else #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -57,7 +70,6 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - typedef struct { void *buf; PyObject *obj; @@ -71,7 +83,6 @@ Py_ssize_t *suboffsets; void *internal; } Py_buffer; - #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 @@ -83,11 +94,9 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) - typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); typedef void (*releasebufferproc)(PyObject *, Py_buffer *); #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ @@ -97,30 +106,30 @@ #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #endif - #if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - - -#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_GET_LENGTH) - #define CYTHON_PEP393_ENABLED - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #else - #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject @@ -128,7 +137,6 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif - #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type @@ -147,7 +155,6 @@ #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif - #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) @@ -155,9 +162,7 @@ #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif - #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) - #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type @@ -174,11 +179,9 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif - #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif - #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -187,7 +190,6 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif - #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) @@ -206,11 +208,9 @@ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -220,7 +220,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -229,6 +228,7 @@ #define __Pyx_DOCSTR(n) (n) #endif + #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) @@ -317,7 +317,11 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) #ifdef __GNUC__ @@ -368,9 +372,10 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "routines.pyx", "numpy.pxd", + "type.pxd", }; -/* "numpy.pxd":722 +/* "numpy.pxd":723 * # in Cython to enable them only on the right systems. * * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< @@ -379,7 +384,7 @@ static const char *__pyx_f[] = { */ typedef npy_int8 __pyx_t_5numpy_int8_t; -/* "numpy.pxd":723 +/* "numpy.pxd":724 * * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< @@ -388,7 +393,7 @@ typedef npy_int8 __pyx_t_5numpy_int8_t; */ typedef npy_int16 __pyx_t_5numpy_int16_t; -/* "numpy.pxd":724 +/* "numpy.pxd":725 * ctypedef npy_int8 int8_t * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< @@ -397,7 +402,7 @@ typedef npy_int16 __pyx_t_5numpy_int16_t; */ typedef npy_int32 __pyx_t_5numpy_int32_t; -/* "numpy.pxd":725 +/* "numpy.pxd":726 * ctypedef npy_int16 int16_t * ctypedef npy_int32 int32_t * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< @@ -406,7 +411,7 @@ typedef npy_int32 __pyx_t_5numpy_int32_t; */ typedef npy_int64 __pyx_t_5numpy_int64_t; -/* "numpy.pxd":729 +/* "numpy.pxd":730 * #ctypedef npy_int128 int128_t * * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< @@ -415,7 +420,7 @@ typedef npy_int64 __pyx_t_5numpy_int64_t; */ typedef npy_uint8 __pyx_t_5numpy_uint8_t; -/* "numpy.pxd":730 +/* "numpy.pxd":731 * * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< @@ -424,7 +429,7 @@ typedef npy_uint8 __pyx_t_5numpy_uint8_t; */ typedef npy_uint16 __pyx_t_5numpy_uint16_t; -/* "numpy.pxd":731 +/* "numpy.pxd":732 * ctypedef npy_uint8 uint8_t * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< @@ -433,7 +438,7 @@ typedef npy_uint16 __pyx_t_5numpy_uint16_t; */ typedef npy_uint32 __pyx_t_5numpy_uint32_t; -/* "numpy.pxd":732 +/* "numpy.pxd":733 * ctypedef npy_uint16 uint16_t * ctypedef npy_uint32 uint32_t * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< @@ -442,7 +447,7 @@ typedef npy_uint32 __pyx_t_5numpy_uint32_t; */ typedef npy_uint64 __pyx_t_5numpy_uint64_t; -/* "numpy.pxd":736 +/* "numpy.pxd":737 * #ctypedef npy_uint128 uint128_t * * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< @@ -451,7 +456,7 @@ typedef npy_uint64 __pyx_t_5numpy_uint64_t; */ typedef npy_float32 __pyx_t_5numpy_float32_t; -/* "numpy.pxd":737 +/* "numpy.pxd":738 * * ctypedef npy_float32 float32_t * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< @@ -460,7 +465,7 @@ typedef npy_float32 __pyx_t_5numpy_float32_t; */ typedef npy_float64 __pyx_t_5numpy_float64_t; -/* "numpy.pxd":746 +/* "numpy.pxd":747 * # The int types are mapped a bit surprising -- * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t # <<<<<<<<<<<<<< @@ -469,7 +474,7 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; */ typedef npy_long __pyx_t_5numpy_int_t; -/* "numpy.pxd":747 +/* "numpy.pxd":748 * # numpy.int corresponds to 'l' and numpy.long to 'q' * ctypedef npy_long int_t * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< @@ -478,7 +483,7 @@ typedef npy_long __pyx_t_5numpy_int_t; */ typedef npy_longlong __pyx_t_5numpy_long_t; -/* "numpy.pxd":748 +/* "numpy.pxd":749 * ctypedef npy_long int_t * ctypedef npy_longlong long_t * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< @@ -487,7 +492,7 @@ typedef npy_longlong __pyx_t_5numpy_long_t; */ typedef npy_longlong __pyx_t_5numpy_longlong_t; -/* "numpy.pxd":750 +/* "numpy.pxd":751 * ctypedef npy_longlong longlong_t * * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< @@ -496,7 +501,7 @@ typedef npy_longlong __pyx_t_5numpy_longlong_t; */ typedef npy_ulong __pyx_t_5numpy_uint_t; -/* "numpy.pxd":751 +/* "numpy.pxd":752 * * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< @@ -505,7 +510,7 @@ typedef npy_ulong __pyx_t_5numpy_uint_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; -/* "numpy.pxd":752 +/* "numpy.pxd":753 * ctypedef npy_ulong uint_t * ctypedef npy_ulonglong ulong_t * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< @@ -514,7 +519,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulong_t; */ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; -/* "numpy.pxd":754 +/* "numpy.pxd":755 * ctypedef npy_ulonglong ulonglong_t * * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< @@ -523,7 +528,7 @@ typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; */ typedef npy_intp __pyx_t_5numpy_intp_t; -/* "numpy.pxd":755 +/* "numpy.pxd":756 * * ctypedef npy_intp intp_t * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< @@ -532,7 +537,7 @@ typedef npy_intp __pyx_t_5numpy_intp_t; */ typedef npy_uintp __pyx_t_5numpy_uintp_t; -/* "numpy.pxd":757 +/* "numpy.pxd":758 * ctypedef npy_uintp uintp_t * * ctypedef npy_double float_t # <<<<<<<<<<<<<< @@ -541,7 +546,7 @@ typedef npy_uintp __pyx_t_5numpy_uintp_t; */ typedef npy_double __pyx_t_5numpy_float_t; -/* "numpy.pxd":758 +/* "numpy.pxd":759 * * ctypedef npy_double float_t * ctypedef npy_double double_t # <<<<<<<<<<<<<< @@ -550,7 +555,7 @@ typedef npy_double __pyx_t_5numpy_float_t; */ typedef npy_double __pyx_t_5numpy_double_t; -/* "numpy.pxd":759 +/* "numpy.pxd":760 * ctypedef npy_double float_t * ctypedef npy_double double_t * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< @@ -590,7 +595,7 @@ typedef unsigned long __pyx_t_3fff_size_t; /*--- Type declarations ---*/ -/* "numpy.pxd":761 +/* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t * * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< @@ -599,7 +604,7 @@ typedef unsigned long __pyx_t_3fff_size_t; */ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; -/* "numpy.pxd":762 +/* "numpy.pxd":763 * * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< @@ -608,7 +613,7 @@ typedef npy_cfloat __pyx_t_5numpy_cfloat_t; */ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; -/* "numpy.pxd":763 +/* "numpy.pxd":764 * ctypedef npy_cfloat cfloat_t * ctypedef npy_cdouble cdouble_t * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< @@ -617,7 +622,7 @@ typedef npy_cdouble __pyx_t_5numpy_cdouble_t; */ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "numpy.pxd":765 +/* "numpy.pxd":766 * ctypedef npy_clongdouble clongdouble_t * * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< @@ -699,6 +704,7 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyOb return r; } static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -708,13 +714,26 @@ static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObje Py_DECREF(old); return 1; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_SetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_ass_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return -1; + i += l; + } return m->sq_ass_item(o, i, v); } } +#else +#if CYTHON_COMPILING_IN_PYPY + if (PySequence_Check(o) && !PyDict_Check(o)) { +#else + if (PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); } @@ -731,42 +750,47 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j __Pyx_GetItemInt_List_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { - PyObject *r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Tuple_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i) { - if (likely(o != Py_None)) { - if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { - PyObject *r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - return r; - } - else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { - PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); - Py_INCREF(r); - return r; - } +#if CYTHON_COMPILING_IN_CPYTHON + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; } return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif } #define __Pyx_GetItemInt(o, i, size, to_py_func) (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) { +#if CYTHON_COMPILING_IN_CPYTHON if (PyList_CheckExact(o)) { Py_ssize_t n = (likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); if (likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { @@ -782,13 +806,22 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i) Py_INCREF(r); return r; } - } - else if (likely(i >= 0)) { + } else { /* inlined PySequence_GetItem() */ PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; if (likely(m && m->sq_item)) { + if (unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (unlikely(l < 0)) return NULL; + i += l; + } return m->sq_item(o, i); } } +#else + if (PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } @@ -797,13 +830,15 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); - static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); -static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ @@ -949,10 +984,10 @@ static int __Pyx_check_binary_version(void); #endif #endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ - static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + typedef struct { int code_line; PyCodeObject* code_object; @@ -981,6 +1016,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'cpython.object' */ +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + /* Module declarations from 'libc.stdlib' */ /* Module declarations from 'numpy' */ @@ -1021,7 +1061,7 @@ static char __pyx_k_8[] = "Format string allocated too short, see comment in num static char __pyx_k_11[] = "Format string allocated too short."; static char __pyx_k_13[] = "\nMiscellaneous fff routines.\n\nAuthor: Alexis Roche, 2008.\n"; static char __pyx_k_14[] = "0.1"; -static char __pyx_k_17[] = "/home/mb312/dev_trees/nipy/nipy/labs/utils/routines.pyx"; +static char __pyx_k_17[] = "/Users/mb312/dev_trees/nipy/nipy/labs/utils/routines.pyx"; static char __pyx_k_18[] = "nipy.labs.utils.routines"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; @@ -1213,12 +1253,11 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_1quantile(PyObject *__pyx double __pyx_v_ratio; int __pyx_v_interp; int __pyx_v_axis; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__ratio,&__pyx_n_s__interp,&__pyx_n_s__axis,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("quantile (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__ratio,&__pyx_n_s__interp,&__pyx_n_s__axis,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1234,12 +1273,10 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_1quantile(PyObject *__pyx kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ratio); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__ratio)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("quantile", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -1257,22 +1294,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_1quantile(PyObject *__pyx if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "quantile") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[2]) { - } else { - - /* "nipy/labs/utils/routines.pyx":45 - * # This is faster than scipy.stats.scoreatpercentile due to partial - * # sorting - * def quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< - * """ - * q = quantile(data, ratio, interp=False, axis=0). - */ - __pyx_v_interp = ((int)0); - } - if (values[3]) { - } else { - __pyx_v_axis = ((int)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1288,6 +1309,14 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_1quantile(PyObject *__pyx if (values[2]) { __pyx_v_interp = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_interp == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { + + /* "nipy/labs/utils/routines.pyx":45 + * # This is faster than scipy.stats.scoreatpercentile due to partial + * # sorting + * def quantile(X, double ratio, int interp=False, int axis=0): # <<<<<<<<<<<<<< + * """ + * q = quantile(data, ratio, interp=False, axis=0). + */ __pyx_v_interp = ((int)0); } if (values[3]) { @@ -1480,12 +1509,11 @@ static PyMethodDef __pyx_mdef_4nipy_4labs_5utils_8routines_3median = {__Pyx_NAME static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_3median(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_x = 0; PyObject *__pyx_v_axis = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__axis,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("median (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__axis,0}; PyObject* values[2] = {0,0}; values[1] = ((PyObject *)__pyx_int_0); if (unlikely(__pyx_kwds)) { @@ -1500,8 +1528,7 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_3median(PyObject *__pyx_s kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -1613,12 +1640,11 @@ static PyMethodDef __pyx_mdef_4nipy_4labs_5utils_8routines_5mahalanobis = {__Pyx static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_5mahalanobis(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_X = 0; PyObject *__pyx_v_VX = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__VX,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("mahalanobis (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__VX,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1632,12 +1658,10 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_5mahalanobis(PyObject *__ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VX); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__VX)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("mahalanobis", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2060,7 +2084,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_7svd(PyObject *__pyx_self PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("svd (wrapper)", 0); - __pyx_self = __pyx_self; __pyx_r = __pyx_pf_4nipy_4labs_5utils_8routines_6svd(__pyx_self, ((PyObject *)__pyx_v_X)); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -2603,12 +2626,11 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_9permutations(PyObject *_ unsigned int __pyx_v_n; unsigned int __pyx_v_m; unsigned long __pyx_v_magic; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__m,&__pyx_n_s__magic,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("permutations (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__m,&__pyx_n_s__magic,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2623,8 +2645,7 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_9permutations(PyObject *_ kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { @@ -2640,14 +2661,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_9permutations(PyObject *_ if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "permutations") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[1]) { - } else { - __pyx_v_m = ((unsigned int)1); - } - if (values[2]) { - } else { - __pyx_v_magic = ((unsigned long)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2807,12 +2820,11 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_11combinations(PyObject * unsigned int __pyx_v_n; unsigned int __pyx_v_m; unsigned long __pyx_v_magic; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__n,&__pyx_n_s__m,&__pyx_n_s__magic,0}; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("combinations (wrapper)", 0); - __pyx_self = __pyx_self; { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__n,&__pyx_n_s__m,&__pyx_n_s__magic,0}; PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2828,12 +2840,10 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_11combinations(PyObject * kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); - if (likely(values[0])) kw_args--; + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); - if (likely(values[1])) kw_args--; + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("combinations", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2851,14 +2861,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_11combinations(PyObject * if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "combinations") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - if (values[2]) { - } else { - __pyx_v_m = ((unsigned int)1); - } - if (values[3]) { - } else { - __pyx_v_magic = ((unsigned long)0); - } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -3020,7 +3022,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_13gamln(PyObject *__pyx_s PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gamln (wrapper)", 0); - __pyx_self = __pyx_self; assert(__pyx_arg_x); { __pyx_v_x = __pyx_PyFloat_AsDouble(__pyx_arg_x); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3097,7 +3098,6 @@ static PyObject *__pyx_pw_4nipy_4labs_5utils_8routines_15psi(PyObject *__pyx_sel PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("psi (wrapper)", 0); - __pyx_self = __pyx_self; assert(__pyx_arg_x); { __pyx_v_x = __pyx_PyFloat_AsDouble(__pyx_arg_x); if (unlikely((__pyx_v_x == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -3165,8 +3165,8 @@ static PyObject *__pyx_pf_4nipy_4labs_5utils_8routines_14psi(CYTHON_UNUSED PyObj } /* Python wrapper */ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ -static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); @@ -3175,7 +3175,7 @@ static int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_bu return __pyx_r; } -/* "numpy.pxd":193 +/* "numpy.pxd":194 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -3214,7 +3214,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __Pyx_GIVEREF(__pyx_v_info->obj); } - /* "numpy.pxd":199 + /* "numpy.pxd":200 * # of flags * * if info == NULL: return # <<<<<<<<<<<<<< @@ -3229,7 +3229,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L3:; - /* "numpy.pxd":202 + /* "numpy.pxd":203 * * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -3238,7 +3238,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":203 + /* "numpy.pxd":204 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -3247,7 +3247,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":205 + /* "numpy.pxd":206 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -3256,7 +3256,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); - /* "numpy.pxd":207 + /* "numpy.pxd":208 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -3266,7 +3266,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":208 + /* "numpy.pxd":209 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -3278,7 +3278,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":210 + /* "numpy.pxd":211 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -3289,7 +3289,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L4:; - /* "numpy.pxd":212 + /* "numpy.pxd":213 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3299,7 +3299,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "numpy.pxd":213 + /* "numpy.pxd":214 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3313,23 +3313,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_3) { - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "numpy.pxd":216 + /* "numpy.pxd":217 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -3339,7 +3339,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "numpy.pxd":217 + /* "numpy.pxd":218 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -3353,23 +3353,23 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_2) { - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_4), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "numpy.pxd":220 + /* "numpy.pxd":221 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -3378,7 +3378,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); - /* "numpy.pxd":221 + /* "numpy.pxd":222 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -3387,7 +3387,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "numpy.pxd":222 + /* "numpy.pxd":223 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -3396,7 +3396,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ if (__pyx_v_copy_shape) { - /* "numpy.pxd":225 + /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -3405,7 +3405,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); - /* "numpy.pxd":226 + /* "numpy.pxd":227 * # This is allocated as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -3414,7 +3414,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "numpy.pxd":227 + /* "numpy.pxd":228 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -3425,7 +3425,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "numpy.pxd":228 + /* "numpy.pxd":229 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -3434,7 +3434,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); - /* "numpy.pxd":229 + /* "numpy.pxd":230 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -3447,7 +3447,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":231 + /* "numpy.pxd":232 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -3456,7 +3456,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); - /* "numpy.pxd":232 + /* "numpy.pxd":233 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -3467,7 +3467,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L7:; - /* "numpy.pxd":233 + /* "numpy.pxd":234 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -3476,7 +3476,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->suboffsets = NULL; - /* "numpy.pxd":234 + /* "numpy.pxd":235 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -3485,7 +3485,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); - /* "numpy.pxd":235 + /* "numpy.pxd":236 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -3494,7 +3494,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); - /* "numpy.pxd":238 + /* "numpy.pxd":239 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -3503,17 +3503,19 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_f = NULL; - /* "numpy.pxd":239 + /* "numpy.pxd":240 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack * cdef int offset */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->descr)); - __pyx_v_descr = __pyx_v_self->descr; + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; - /* "numpy.pxd":243 + /* "numpy.pxd":244 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -3522,7 +3524,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "numpy.pxd":245 + /* "numpy.pxd":246 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -3538,7 +3540,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":247 + /* "numpy.pxd":248 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -3554,7 +3556,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":250 + /* "numpy.pxd":251 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -3569,30 +3571,31 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } __pyx_L10:; - /* "numpy.pxd":252 + /* "numpy.pxd":253 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or + * if ((descr.byteorder == c'>' and little_endian) or */ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "numpy.pxd":253 + /* "numpy.pxd":254 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): */ - __pyx_v_t = __pyx_v_descr->type_num; + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; - /* "numpy.pxd":254 + /* "numpy.pxd":255 * if not hasfields: * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (descr.byteorder == '<' and not little_endian)): + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); @@ -3603,10 +3606,10 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (!__pyx_t_2) { - /* "numpy.pxd":255 + /* "numpy.pxd":256 * t = descr.type_num - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ @@ -3623,24 +3626,24 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } if (__pyx_t_1) { - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; - /* "numpy.pxd":257 - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" @@ -3652,7 +3655,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":258 + /* "numpy.pxd":259 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -3665,7 +3668,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":259 + /* "numpy.pxd":260 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -3678,7 +3681,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":260 + /* "numpy.pxd":261 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -3691,7 +3694,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":261 + /* "numpy.pxd":262 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -3704,7 +3707,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":262 + /* "numpy.pxd":263 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -3717,7 +3720,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":263 + /* "numpy.pxd":264 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -3730,7 +3733,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":264 + /* "numpy.pxd":265 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -3743,7 +3746,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":265 + /* "numpy.pxd":266 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -3756,7 +3759,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":266 + /* "numpy.pxd":267 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -3769,7 +3772,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":267 + /* "numpy.pxd":268 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -3782,7 +3785,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":268 + /* "numpy.pxd":269 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -3795,7 +3798,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":269 + /* "numpy.pxd":270 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -3808,7 +3811,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":270 + /* "numpy.pxd":271 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -3821,7 +3824,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":271 + /* "numpy.pxd":272 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -3834,7 +3837,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":272 + /* "numpy.pxd":273 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -3847,7 +3850,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P goto __pyx_L13; } - /* "numpy.pxd":273 + /* "numpy.pxd":274 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -3861,33 +3864,33 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":275 + /* "numpy.pxd":276 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; - /* "numpy.pxd":276 + /* "numpy.pxd":277 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -3896,7 +3899,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_v_info->format = __pyx_v_f; - /* "numpy.pxd":277 + /* "numpy.pxd":278 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -3909,51 +3912,51 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /*else*/ { - /* "numpy.pxd":279 + /* "numpy.pxd":280 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "numpy.pxd":280 + /* "numpy.pxd":281 * else: * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< * offset = 0 * f = _util_dtypestring(descr, info.format + 1, */ (__pyx_v_info->format[0]) = '^'; - /* "numpy.pxd":281 + /* "numpy.pxd":282 * info.format = stdlib.malloc(_buffer_format_string_len) - * info.format[0] = '^' # Native data types, manual alignment + * info.format[0] = c'^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, */ __pyx_v_offset = 0; - /* "numpy.pxd":284 + /* "numpy.pxd":285 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< - * f[0] = 0 # Terminate format string + * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "numpy.pxd":285 + /* "numpy.pxd":286 * info.format + _buffer_format_string_len, * &offset) - * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< * * def __releasebuffer__(ndarray self, Py_buffer* info): */ - (__pyx_v_f[0]) = 0; + (__pyx_v_f[0]) = '\x00'; } __pyx_L11:; @@ -3981,16 +3984,16 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P } /* Python wrapper */ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":287 - * f[0] = 0 # Terminate format string +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< * if PyArray_HASFIELDS(self): @@ -4002,7 +4005,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__", 0); - /* "numpy.pxd":288 + /* "numpy.pxd":289 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -4012,7 +4015,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); if (__pyx_t_1) { - /* "numpy.pxd":289 + /* "numpy.pxd":290 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -4024,7 +4027,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s } __pyx_L3:; - /* "numpy.pxd":290 + /* "numpy.pxd":291 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -4034,7 +4037,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "numpy.pxd":291 + /* "numpy.pxd":292 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -4049,7 +4052,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":767 +/* "numpy.pxd":768 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -4066,7 +4069,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); - /* "numpy.pxd":768 + /* "numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -4074,7 +4077,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4092,7 +4095,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ return __pyx_r; } -/* "numpy.pxd":770 +/* "numpy.pxd":771 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -4109,7 +4112,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); - /* "numpy.pxd":771 + /* "numpy.pxd":772 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -4117,7 +4120,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4135,7 +4138,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ return __pyx_r; } -/* "numpy.pxd":773 +/* "numpy.pxd":774 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -4152,7 +4155,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); - /* "numpy.pxd":774 + /* "numpy.pxd":775 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -4160,7 +4163,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4178,7 +4181,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ return __pyx_r; } -/* "numpy.pxd":776 +/* "numpy.pxd":777 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -4195,7 +4198,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); - /* "numpy.pxd":777 + /* "numpy.pxd":778 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -4203,7 +4206,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4221,7 +4224,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ return __pyx_r; } -/* "numpy.pxd":779 +/* "numpy.pxd":780 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -4238,7 +4241,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); - /* "numpy.pxd":780 + /* "numpy.pxd":781 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -4246,7 +4249,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4264,7 +4267,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ return __pyx_r; } -/* "numpy.pxd":782 +/* "numpy.pxd":783 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -4287,18 +4290,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; + PyObject *(*__pyx_t_6)(PyObject *); int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; - long __pyx_t_10; - char *__pyx_t_11; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_util_dtypestring", 0); - /* "numpy.pxd":789 + /* "numpy.pxd":790 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -4307,7 +4311,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_endian_detector = 1; - /* "numpy.pxd":790 + /* "numpy.pxd":791 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -4316,7 +4320,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "numpy.pxd":793 + /* "numpy.pxd":794 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -4324,31 +4328,36 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 793; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":794 + /* "numpy.pxd":795 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "numpy.pxd":795 + /* "numpy.pxd":796 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -4357,20 +4366,49 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { PyObject* sequence = ((PyObject *)__pyx_v_fields); - if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { - if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); - else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); - } else { - __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -4378,99 +4416,98 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_v_new_offset = __pyx_t_4; __pyx_t_4 = 0; - /* "numpy.pxd":797 + /* "numpy.pxd":798 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_9), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; } - __pyx_L5:; + __pyx_L7:; - /* "numpy.pxd":800 + /* "numpy.pxd":801 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * - * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< - * (child.byteorder == '<' and not little_endian)): + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); - if (__pyx_t_6) { - __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_7; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "numpy.pxd":801 + /* "numpy.pxd":802 * - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); - if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; } else { - __pyx_t_9 = __pyx_t_6; + __pyx_t_10 = __pyx_t_7; } - __pyx_t_6 = __pyx_t_9; + __pyx_t_7 = __pyx_t_10; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_7 = __pyx_t_8; } - if (__pyx_t_6) { + if (__pyx_t_7) { - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L6; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; } - __pyx_L6:; + __pyx_L8:; - /* "numpy.pxd":812 + /* "numpy.pxd":813 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -4478,16 +4515,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!__pyx_t_6) break; + if (!__pyx_t_7) break; - /* "numpy.pxd":813 + /* "numpy.pxd":814 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -4496,7 +4532,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ (__pyx_v_f[0]) = 120; - /* "numpy.pxd":814 + /* "numpy.pxd":815 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -4505,430 +4541,413 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_v_f = (__pyx_v_f + 1); - /* "numpy.pxd":815 + /* "numpy.pxd":816 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< * * offset[0] += child.itemsize */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + 1); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); } - /* "numpy.pxd":817 + /* "numpy.pxd":818 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< * * if not PyDataType_HASFIELDS(child): */ - __pyx_t_10 = 0; - (__pyx_v_offset[__pyx_t_10]) = ((__pyx_v_offset[__pyx_t_10]) + __pyx_v_child->elsize); + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); - /* "numpy.pxd":819 + /* "numpy.pxd":820 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< * t = child.type_num * if end - f < 5: */ - __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); - if (__pyx_t_6) { + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { - /* "numpy.pxd":820 + /* "numpy.pxd":821 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "numpy.pxd":821 + /* "numpy.pxd":822 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); - if (__pyx_t_6) { + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L10; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } - __pyx_L10:; + __pyx_L12:; - /* "numpy.pxd":825 + /* "numpy.pxd":826 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 98; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":826 + /* "numpy.pxd":827 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 66; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":827 + /* "numpy.pxd":828 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 104; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":828 + /* "numpy.pxd":829 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 72; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":829 + /* "numpy.pxd":830 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 105; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":830 + /* "numpy.pxd":831 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 73; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":831 + /* "numpy.pxd":832 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 108; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":832 + /* "numpy.pxd":833 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 76; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":833 + /* "numpy.pxd":834 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 113; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":834 + /* "numpy.pxd":835 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 81; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":835 + /* "numpy.pxd":836 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 102; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":836 + /* "numpy.pxd":837 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 100; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":837 + /* "numpy.pxd":838 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 103; - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":838 + /* "numpy.pxd":839 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 102; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":839 + /* "numpy.pxd":840 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 100; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":840 + /* "numpy.pxd":841 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 90; (__pyx_v_f[1]) = 103; __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L11; + goto __pyx_L13; } - /* "numpy.pxd":841 + /* "numpy.pxd":842 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__pyx_t_6) { + if (__pyx_t_7) { (__pyx_v_f[0]) = 79; - goto __pyx_L11; + goto __pyx_L13; } /*else*/ { - /* "numpy.pxd":843 + /* "numpy.pxd":844 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_7), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L13:; - /* "numpy.pxd":844 + /* "numpy.pxd":845 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -4936,25 +4955,25 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # Cython ignores struct boundary information ("T{...}"), */ __pyx_v_f = (__pyx_v_f + 1); - goto __pyx_L9; + goto __pyx_L11; } /*else*/ { - /* "numpy.pxd":848 + /* "numpy.pxd":849 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_11 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_11 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_f = __pyx_t_11; + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; } - __pyx_L9:; + __pyx_L11:; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "numpy.pxd":849 + /* "numpy.pxd":850 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -4983,7 +5002,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx return __pyx_r; } -/* "numpy.pxd":964 +/* "numpy.pxd":965 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -4997,7 +5016,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base", 0); - /* "numpy.pxd":966 + /* "numpy.pxd":967 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -5007,7 +5026,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "numpy.pxd":967 + /* "numpy.pxd":968 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -5019,7 +5038,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } /*else*/ { - /* "numpy.pxd":969 + /* "numpy.pxd":970 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -5028,7 +5047,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_INCREF(__pyx_v_base); - /* "numpy.pxd":970 + /* "numpy.pxd":971 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -5039,7 +5058,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a } __pyx_L3:; - /* "numpy.pxd":971 + /* "numpy.pxd":972 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -5048,7 +5067,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a */ Py_XDECREF(__pyx_v_arr->base); - /* "numpy.pxd":972 + /* "numpy.pxd":973 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -5060,7 +5079,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a __Pyx_RefNannyFinishContext(); } -/* "numpy.pxd":974 +/* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5074,7 +5093,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base", 0); - /* "numpy.pxd":975 + /* "numpy.pxd":976 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -5084,7 +5103,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "numpy.pxd":976 + /* "numpy.pxd":977 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -5099,7 +5118,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } /*else*/ { - /* "numpy.pxd":978 + /* "numpy.pxd":979 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -5214,9 +5233,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -5226,84 +5245,84 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "numpy.pxd":214 + /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); PyTuple_SET_ITEM(__pyx_k_tuple_2, 0, ((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "numpy.pxd":218 + /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_4 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); PyTuple_SET_ITEM(__pyx_k_tuple_4, 0, ((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_4)); - /* "numpy.pxd":256 - * if ((descr.byteorder == '>' and little_endian) or - * (descr.byteorder == '<' and not little_endian)): + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_6 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_6); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_6, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); - /* "numpy.pxd":798 + /* "numpy.pxd":799 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * - * if ((child.byteorder == '>' and little_endian) or + * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_9 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_9)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_9); __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); PyTuple_SET_ITEM(__pyx_k_tuple_9, 0, ((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_9)); - /* "numpy.pxd":802 - * if ((child.byteorder == '>' and little_endian) or - * (child.byteorder == '<' and not little_endian)): + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_10); __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); - /* "numpy.pxd":822 + /* "numpy.pxd":823 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_12); __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); @@ -5682,16 +5701,23 @@ PyMODINIT_FUNC PyInit_routines(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("routines"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("routines"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_13), 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif - if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - #if PY_MAJOR_VERSION < 3 - Py_INCREF(__pyx_m); + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "nipy.labs.utils.routines")) { + if (unlikely(PyDict_SetItemString(modules, "nipy.labs.utils.routines", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); #endif - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); - if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5707,11 +5733,18 @@ PyMODINIT_FUNC PyInit_routines(void) /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ @@ -5861,7 +5894,7 @@ PyMODINIT_FUNC PyInit_routines(void) if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "numpy.pxd":974 + /* "numpy.pxd":975 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -5923,7 +5956,7 @@ static void __Pyx_RaiseArgtupleInvalid( more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, - "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } @@ -5937,7 +5970,7 @@ static void __Pyx_RaiseDoubleKeywordsError( "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, - PyString_AS_STRING(kw_name)); + PyString_AsString(kw_name)); #endif } @@ -5958,48 +5991,72 @@ static int __Pyx_ParseOptionalKeywords( while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; - } else { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; - } else { - for (name = first_kw_arg; *name; name++) { - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) break; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) break; - #endif - } - if (*name) { + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { values[name-argnames] = value; - } else { - for (name=argnames; name != first_kw_arg; name++) { - if (**name == key) goto arg_passed_twice; - #if PY_MAJOR_VERSION >= 3 - if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && - PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; - #else - if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - _PyString_Eq(**name, key)) goto arg_passed_twice; - #endif - } - if (kwds2) { - if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; - } else { - goto invalid_keyword; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; } } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; } } return 0; arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, **name); + __Pyx_RaiseDoubleKeywordsError(function_name, key); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, @@ -6018,8 +6075,6 @@ static int __Pyx_ParseOptionalKeywords( return -1; } - - static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); @@ -6035,9 +6090,8 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { return result; } - - static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; @@ -6049,8 +6103,12 @@ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyOb Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -6058,44 +6116,47 @@ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyOb tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { - /* cause is unused */ Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - /* First, check the traceback argument, replacing None with NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = 0; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; + if (!value || value == Py_None) + value = NULL; + else Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } } #if PY_VERSION_HEX < 0x02050000 - if (!PyClass_Check(type)) + if (PyClass_Check(type)) { #else - if (!PyType_Check(type)) + if (PyType_Check(type)) { #endif - { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } - /* Normalize to raise , */ - Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { @@ -6128,6 +6189,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { @@ -6145,12 +6207,36 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } value = type; type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } + else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } - if (cause) { + if (cause && cause != Py_None) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); @@ -6167,9 +6253,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject "BaseException"); goto bad; } - if (!value) { - value = PyObject_CallObject(type, NULL); - } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); @@ -6183,33 +6266,69 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } } bad: + Py_XDECREF(owned_instance); return; } #endif -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, - "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", - index, (index == 1) ? "" : "s"); + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, - "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } -static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { - if (t == Py_None) { - __Pyx_RaiseNoneNotIterableError(); - } else if (PyTuple_GET_SIZE(t) < index) { - __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; } else { - __Pyx_RaiseTooManyValuesError(index); + return __Pyx_IterFinish(); } + return 0; } static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { @@ -6250,12 +6369,33 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { goto bad; #if PY_VERSION_HEX >= 0x02050000 { - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + /* try package relative import first */ + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + } } #else if (level>0) { @@ -6931,6 +7071,23 @@ static int __Pyx_check_binary_version(void) { return 0; } +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, @@ -6983,23 +7140,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -#ifndef __PYX_HAVE_RT_ImportModule -#define __PYX_HAVE_RT_ImportModule -static PyObject *__Pyx_ImportModule(const char *name) { - PyObject *py_name = 0; - PyObject *py_module = 0; - py_name = __Pyx_PyIdentifier_FromString(name); - if (!py_name) - goto bad; - py_module = PyImport_Import(py_name); - Py_DECREF(py_name); - return py_module; -bad: - Py_XDECREF(py_name); - return 0; -} -#endif - static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { int start = 0, mid = 0, end = count - 1; if (end >= 0 && code_line > entries[end].code_line) { @@ -7116,11 +7256,11 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ py_line, /*int firstlineno,*/ From d4bf84293202b0dd073deaa7150762939435efda Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 14 Jan 2013 18:48:29 +0000 Subject: [PATCH 087/164] NF: make target to recythonize pyx files Run cython on all found .pyx files. --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 93a5e13aed..65fdc5b82f 100644 --- a/Makefile +++ b/Makefile @@ -101,5 +101,9 @@ tox-stale: # installed) tox -e python25,python26,python27,python32,np-1.2.1 +recythonize: + # Recythonize all pyx files + find . -name "*.pyx" -exec cython -I libcstat/wrapper {} \; + .PHONY: orig-src pylint From 4276de6d1ad34dc01c0b6a6512846f21d6daf2e3 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Mon, 14 Jan 2013 21:29:04 +0000 Subject: [PATCH 088/164] DOC: update Changelog for 0.3 release --- Changelog | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Changelog b/Changelog index 80055f9c45..136b86edda 100644 --- a/Changelog +++ b/Changelog @@ -22,6 +22,39 @@ The full VCS changelog is available here: Releases ~~~~~~~~ +Abbreviated authors are: + +* MB - Matthew Brett +* BT - Bertrand Thirion +* AR - Alexis Roche +* GV - Gaël Varoquaux +* YH - Yarik Halchenko + +* 0.3.0 (Monday 14 January 2013) + + * Bugfix, refactoring and compatibility release + * Addition of EM algorithm for mixed effects analysis (BT) + * New high-level GLM class interface (BT) + * nipy diagnostic scripts save PCA and tsdifana vectors to npz file + * Python 3 compatibility through 3.3 (MB) + * Fixes for compatibility with upcoming Numpy 1.7 + * Fixes to background and axis specification in visualization tools (GV, BT) + * Fixes and tests for installed nipy scripts (MB) + * Fix to optimization parameters for Realign4D - thanks to `bpinsard` + * Fix 0 in affine diagonal for TR=0 in affines by default (MB) + * Allow saving of nipy images loaded from nifti files that lack explicit + affine (MB) + * Allow `slice_order=None` to `FmriRealign4D` when not doing time + interpolation (AR); check for valid slice order specification (YR) + * Refactoring of quantile routine to move code out of C library (AR) + * Fix bug in resampling of unsigned int images (AR) + * Custom doctest machinery to work round differences of dtype repr on + different platforms, and to skip doctests with optional dependencies (MB) + * Script to run examples for testing (MB) + * Fix for accidental integer division of frametimes in design matrix + generation (Fabian Pedregosa) + * Various other fixes and refactorings with thanks from (AR, BT, MB, YR) + * 0.2.0 (Sunday 22 July 2012) * The first ever official release From 23a84556cb5099fc1ef41543fc309b32b86b8266 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 15 Jan 2013 13:33:01 +0000 Subject: [PATCH 089/164] NF: add script_test label to tests for scripts Using this to debug why the script tests are failing using the nibabel sdist tester. --- nipy/tests/test_scripts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index 99231d6dea..d70fa1f611 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -23,10 +23,13 @@ from ..testing import funcfile from numpy.testing import decorators, assert_almost_equal +from nipy.testing.decorators import make_label_dec + from nibabel.optpkg import optional_package matplotlib, HAVE_MPL, _ = optional_package('matplotlib') needs_mpl = decorators.skipif(not HAVE_MPL, "Test needs matplotlib") +script_test = make_label_dec('script_test') USE_SHELL = os.name != 'nt' @@ -65,6 +68,7 @@ def run_command(cmd): @needs_mpl +@script_test def test_nipy_diagnose(): # Test nipy diagnose script fimg = load_image(funcfile) @@ -92,6 +96,7 @@ def test_nipy_diagnose(): @needs_mpl +@script_test def test_nipy_tsdiffana(): # Test nipy_tsdiffana script out_png = 'ts_out.png' @@ -102,6 +107,7 @@ def test_nipy_tsdiffana(): assert_true(isfile(out_png)) +@script_test def test_nipy_3_4d(): # Test nipy_3dto4d and nipy_4dto3d fimg = load_image(funcfile) From 5accad7ca5deae2cee5c504b0ac87919d1a5d00a Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 15 Jan 2013 16:49:49 +0000 Subject: [PATCH 090/164] DOC: update release instructions for script tests I needed to change the automated script tests in nibabel to accomodate the script tests in nipy. --- doc/devel/guidelines/make_release.rst | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index c37e266a05..fd542adb03 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -68,7 +68,7 @@ Release checklist running. * Check the ``long_description`` in ``nipy/info.py``. Check it matches the - ``README`` in the root directory. + ``README`` in the root directory, maybe with ``vim`` ``diffthis`` command. * Do a final check on the `nipy buildbot`_ @@ -104,7 +104,17 @@ Release checklist make bdist-egg-tests - and the three ways of installing (from tarball, repo, local in repo):: + This one may well fail because of a problem with the script tests; if you have + a recent (>= Jan 15 2013) nibabel ``nisext`` package, you could try instead + doing:: + + python -c 'from nisext.testers import bdist_egg_tests; bdist_egg_tests("nipy", label="not slow and not script_test")' + + Eventually we should update the ``bdist-egg-tests`` makefile target. + +* Check the installation commit hash storage. + + This checks the three ways of installing (from tarball, repo, local in repo):: make check-version-info @@ -164,7 +174,7 @@ Release checklist # in wine bash make sdist-tests - For the PPC I have to log into an old Mac G5 in Berkeley at + For the PPC I have to log into a MacPro in Berkeley at ``alexis.bic.berkeley.edu``. Here's an example session:: ssh alexis.bic.berkeley.edu @@ -179,8 +189,12 @@ Release checklist make doctest cd .. + You will need an importable version of NIPY on the python path to do this + check. + * Check everything compiles without syntax errors:: + make distclean python -m compileall . * The release should now be ready. From d7953f3fa6c6c24ab2771c2a4adc4f1277f3b500 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 15 Jan 2013 16:51:16 +0000 Subject: [PATCH 091/164] DOC: update surrogate array docs / docstrings The API seems to have changed a little; update imports and documentation Fix docstrings for sphinx errors. --- doc/labs/plots/surrogate_array.py | 3 ++- doc/labs/simul_activation.rst | 19 +++++++++++-------- .../utils/simul_multisubject_fmri_dataset.py | 7 +++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/doc/labs/plots/surrogate_array.py b/doc/labs/plots/surrogate_array.py index d3e0918f99..0daf7f8a96 100644 --- a/doc/labs/plots/surrogate_array.py +++ b/doc/labs/plots/surrogate_array.py @@ -1,6 +1,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import numpy as np + import pylab as pl from nipy.labs.utils.simul_multisubject_fmri_dataset import \ @@ -13,7 +14,7 @@ # First generate some noiseless data noiseless_data = surrogate_2d_dataset(n_subj=1, noise_level=0, spatial_jitter=0, - signal_jitter=0, pos=pos, ampli=ampli) + signal_jitter=0, pos=pos, ampli=ampli) pl.figure(figsize=(10, 3)) pl.subplot(1, 4, 1) diff --git a/doc/labs/simul_activation.rst b/doc/labs/simul_activation.rst index e4972be128..c260a29ca1 100644 --- a/doc/labs/simul_activation.rst +++ b/doc/labs/simul_activation.rst @@ -2,15 +2,15 @@ Generating simulated activation maps ===================================== -.. currentmodule:: nipy.labs.utils.simul_2d_multisubject_fmri_dataset +.. currentmodule:: nipy.labs.utils.simul_multisubject_fmri_dataset -The module :mod:`nipy.labs.utils.simul_2d_multisubject_fmri_dataset` -contains a function to create simulated 2D activation maps: -:func:`make_surrogate_array`. The function can position various -activations and add noise, both as background noise and jitter in the -activation positions and amplitude. +The module :mod:`nipy.labs.utils.simul_multisubject_fmri_dataset` +contains a various functions to create simulated activation maps in two, three +and four dimensions. A 2D example is :func:`surrogate_2d_dataset`. The +functions can position various activations and add noise, both as background +noise and jitter in the activation positions and amplitude. -This function is useful to test methods. +These functions can be useful to test methods. Example -------- @@ -22,5 +22,8 @@ Example Function documentation ------------------------- -.. autofunction:: make_surrogate_array +.. autofunction:: surrogate_2d_dataset +.. autofunction:: surrogate_3d_dataset + +.. autofunction:: surrogate_4d_dataset diff --git a/nipy/labs/utils/simul_multisubject_fmri_dataset.py b/nipy/labs/utils/simul_multisubject_fmri_dataset.py index d4e532a4c1..70db0773a6 100644 --- a/nipy/labs/utils/simul_multisubject_fmri_dataset.py +++ b/nipy/labs/utils/simul_multisubject_fmri_dataset.py @@ -70,7 +70,7 @@ def surrogate_2d_dataset(n_subj=10, shape=(30, 30), sk=1.0, in pixel. signal_jitter: float, optionnal Random amplitude fluctuation for each activation, added to the - amplitude specified by ampli + amplitude specified by `ampli` width: float or ndarray, optionnal Width of the activations width_jitter: float @@ -88,7 +88,7 @@ def surrogate_2d_dataset(n_subj=10, shape=(30, 30), sk=1.0, Returns ------- dataset: 3D ndarray - The surrogate activation map, with dimensions (n_subj, *shape) + The surrogate activation map, with dimensions ``(n_subj,) + shape`` """ if seed: nr = np.random.RandomState([seed]) @@ -177,8 +177,7 @@ def surrogate_3d_dataset(n_subj=1, shape=(20, 20, 20), mask=None, Returns ------- dataset: 3D ndarray - The surrogate activation map, with dimensions - (n_subj, *shape) + The surrogate activation map, with dimensions ``(n_subj,) + shape`` """ if seed: nr = np.random.RandomState([seed]) From ba004b5692bd64d3c2dd2b272789714efcb23029 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Tue, 15 Jan 2013 17:08:49 +0000 Subject: [PATCH 092/164] DOC: minor rejigging of enn doc / docstrings There were confusing sphinx errors for the ``enn.rst`` file. Some were solved by upgrading Sphinx from 1.0.3 to 1.1.3; the docstring edit solved a couple of indentation errors. --- doc/labs/enn.rst | 43 +++++++++---------- doc/labs/plots/enn_demo.py | 7 +-- .../algorithms/statistics/empirical_pvalue.py | 12 +++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/doc/labs/enn.rst b/doc/labs/enn.rst index b83483fdcd..1023646dc3 100644 --- a/doc/labs/enn.rst +++ b/doc/labs/enn.rst @@ -4,40 +4,39 @@ Empirical null .. currentmodule:: nipy.algorithms.statistics.empirical_pvalue -The :mod:`nipy.algorithms.statistics.empirical_pvalue` module contains a class that fits a -Gaussian model to the central part of an histogram, following Schwartzman -et al, 2009. This is typically necessary to estimate a FDR when one is -not certain that the data behaves as a standard normal under H_0. - -The `NormalEmpiricalNull` class learns its null distribution on the data provided at -initialisation. Two different methods can be used to set a threshold -from the null distribution: the :meth:`NormalEmpiricalNull.threshold` method returns the -threshold for a given false discovery rate, and thus accounts for +The :mod:`nipy.algorithms.statistics.empirical_pvalue` module contains a class +that fits a Gaussian model to the central part of an histogram, following +Schwartzman et al, 2009. This is typically necessary to estimate a FDR when one +is not certain that the data behaves as a standard normal under H_0. + +The `NormalEmpiricalNull` class learns its null distribution on the data +provided at initialisation. Two different methods can be used to set a threshold +from the null distribution: the :meth:`NormalEmpiricalNull.threshold` method +returns the threshold for a given false discovery rate, and thus accounts for multiple comparisons with the given dataset; the -:meth:`NormalEmpiricalNull.uncorrected_threshold` returns the threshold for a given -uncorrected p-value, and as such does not account for multiple +:meth:`NormalEmpiricalNull.uncorrected_threshold` returns the threshold for a +given uncorrected p-value, and as such does not account for multiple comparisons. Example ---------- +------- If we use the empirical normal null estimator on a two Gaussian mixture -distribution, with a central Gaussian, and a wide one, it uses the -central distribution as a null hypothesis, and returns the threshold -following which the data can be claimed to belong to the wide Gaussian: +distribution, with a central Gaussian, and a wide one, it uses the central +distribution as a null hypothesis, and returns the threshold following which the +data can be claimed to belong to the wide Gaussian: .. plot:: labs/plots/enn_demo.py :include-source: -The threshold evaluated with the :meth:`NormalEmpiricalNull.threshold` method is around -2.8 (using the default p-value of 0.05). The -:meth:`NormalEmpiricalNull.uncorrected_threshold` returns, for the same p-value, a -threshold of 1.9. It is necessary to use a higher p-value with -uncorrected comparisons. +The threshold evaluated with the :meth:`NormalEmpiricalNull.threshold` method is +around 2.8 (using the default p-value of 0.05). The +:meth:`NormalEmpiricalNull.uncorrected_threshold` returns, for the same p-value, +a threshold of 1.9. It is necessary to use a higher p-value with uncorrected +comparisons. Class documentation --------------------- - +------------------- .. autoclass:: NormalEmpiricalNull :members: diff --git a/doc/labs/plots/enn_demo.py b/doc/labs/plots/enn_demo.py index 783f2c186a..5a1e944348 100644 --- a/doc/labs/plots/enn_demo.py +++ b/doc/labs/plots/enn_demo.py @@ -1,10 +1,11 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: import numpy as np -x = np.c_[np.random.normal(size=1e4), - np.random.normal(scale=4, size=1e4)] from nipy.algorithms.statistics.empirical_pvalue import NormalEmpiricalNull + +x = np.c_[np.random.normal(size=1e4), + np.random.normal(scale=4, size=1e4)] + enn = NormalEmpiricalNull(x) enn.threshold(verbose=True) - diff --git a/nipy/algorithms/statistics/empirical_pvalue.py b/nipy/algorithms/statistics/empirical_pvalue.py index 17dcc5c13b..f512897b5f 100644 --- a/nipy/algorithms/statistics/empirical_pvalue.py +++ b/nipy/algorithms/statistics/empirical_pvalue.py @@ -188,12 +188,12 @@ def learn(self, left=0.2, right=0.8): ----- This method stores the following attributes: - mu = mu - p0 = min(1, np.exp(lp0)) - sqsigma: standard deviation of the estimated normal - distribution - sigma: np.sqrt(sqsigma) : variance of the estimated - normal distribution + * mu = mu + * p0 = min(1, np.exp(lp0)) + * sqsigma: standard deviation of the estimated normal + distribution + * sigma: np.sqrt(sqsigma) : variance of the estimated + normal distribution """ # take a central subsample of x x = self.x[int(self.n * left): int(self.n * right)] From a2489516ac59fa95407648062b7762eaad2af1fa Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 16 Jan 2013 00:13:16 +0000 Subject: [PATCH 093/164] DOC: updating doctests sphinx docs Doctests are all now passing on my box, but with some extra changes in the code, that I will submit as a separate pull request. Basically I needed to allow objects for coordinate map coordinate types to allow the sympy things that Jonathan is doing in the long coordinate map discussion. --- doc/devel/code_discussions/coordmap_notes.rst | 241 +++++++++--------- doc/users/basic_io.rst | 1 + doc/users/glm_spec.rst | 35 ++- doc/users/math_coordmap.rst | 7 +- 4 files changed, 144 insertions(+), 140 deletions(-) diff --git a/doc/devel/code_discussions/coordmap_notes.rst b/doc/devel/code_discussions/coordmap_notes.rst index ef671157b5..a7bdbc0448 100644 --- a/doc/devel/code_discussions/coordmap_notes.rst +++ b/doc/devel/code_discussions/coordmap_notes.rst @@ -19,6 +19,8 @@ reordering of images that needed known axis ordering. .. some working notes +:: + import sympy i, j, k = sympy.symbols('i, j, k') np.dot(np.array([[0,0,1],[1,0,0],[0,1,0]]), np.array([i,j,k])) @@ -276,7 +278,8 @@ the acquisition parameters, these coordinates might have names like "phase", Now, I can encode all this information in a tuple: (T=a 4x4 matrix of floats with bottom row [0,0,0,1], ('phase', 'freq', "slice"), ('x','y','z')) ->>> from nipy.core.api import CoordinateSystem +>>> import numpy as np +>>> from nipy.core.api import CoordinateSystem, AffineTransform >>> acquisition = ('phase', 'freq', 'slice') >>> xyz_world = ('x','y','z') >>> T = np.array([[2,0,0,-91.095],[0,2,0,-129.51],[0,0,2,-73.25],[0,0,0,1]]) @@ -421,35 +424,13 @@ AffineTransform( [ 0. , 0. , 0. , 1. ]]) ) -Or, working with an LPIImage rather than an AffineTransform - ->>> from nipy.core.api import LPIImage ->>> data = np.random.standard_normal((92,114,84)) ->>> im = LPIImage(data, A.affine, unknown_acquisition) ->>> im_slice_3rd = im.renamed_axes(k='slice') ->>> im_slice_3rd.lpi_transform -LPITransform( - function_domain=CoordinateSystem(coord_names=('i', 'j', 'slice'), name='voxel', coord_dtype=float64), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='world-LPI', coord_dtype=float64), - affine=array([[ 2. , 0. , 0. , -91.095], - [ 0. , 2. , 0. , -129.51 ], - [ 0. , 0. , 2. , -73.25 ], - [ 0. , 0. , 0. , 1. ]]) -) - -Note that A does not have 'voxel' or 'world-LPI' in it, but the lpi_transform -attribute of im does. The ('x','y','z') paired with ('world-LPI') is interpreted -to mean: "x is left-> right", "y is posterior-> anterior", "z is inferior to -superior", and the first number output from the python function -transform_function above is "x", the second is "y", the third is "z". - Another question one might ask is: why bother allowing non-4x4 affine matrices like: >>> AffineTransform.from_params('ij', 'xyz', np.array([[2,3,1,0],[3,4,5,0],[7,9,3,1]]).T) AffineTransform( - function_domain=CoordinateSystem(coord_names=('i', 'j'), name='domain', coord_dtype=float64), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='range', coord_dtype=float64), + function_domain=CoordinateSystem(coord_names=('i', 'j'), name='', coord_dtype=float64), + function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=float64), affine=array([[ 2., 3., 7.], [ 3., 4., 9.], [ 1., 5., 3.], @@ -461,7 +442,8 @@ For one, it allows very clear specification of a 2-dimensional plane (i.e. a "coordinate system". Let's say we want the plane in LPI-world corresponding to "j=30" for im above. (I guess that's coronal?) ->>> # make an affine transform that maps (i,k) -> (i,30,k) +Make an affine transform that maps (i,k) -> (i,30,k): + >>> j30 = AffineTransform(CoordinateSystem('ik'), CoordinateSystem('ijk'), np.array([[1,0,0],[0,0,30],[0,1,0],[0,0,1]])) >>> j30 AffineTransform( @@ -472,32 +454,41 @@ AffineTransform( [ 0., 1., 0.], [ 0., 0., 1.]]) ) ->>> # it's dtype is np.float since we didn't specify np.int in constructing the CoordinateSystems ->>> j30_to_LPI = compose(im.lpi_transform, j30) ->>> j30_to_LPI +Its dtype is np.float since we didn't specify np.int in constructing the +CoordinateSystems: + +>>> from nipy.core.api import compose +>>> j30_to_XYZ = compose(A, j30) +>>> j30_to_XYZ AffineTransform( function_domain=CoordinateSystem(coord_names=('i', 'k'), name='', coord_dtype=float64), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='world-LPI', coord_dtype=float64), + function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=float64), affine=array([[ 2. , 0. , -91.095], [ 0. , 0. , -69.51 ], [ 0. , 2. , -73.25 ], [ 0. , 0. , 1. ]]) ) -This could be used to resample any LPIImage on the coronal plane y=-69.51 with -voxels of size 2mmx2mm starting at x=-91.095 and z=-73.25. Of course, this +This could be used to resample any RAS Image on the coronal plane y=-69.51 with +voxels of size 2mm x 2mm starting at x=-91.095 and z=-73.25. Of course, this doesn't seem like a very natural slice. The module :mod:`nipy.core.reference.slices` has some convenience functions for specifying -slices +slices. +>>> from nipy.core.reference.slices import yslice, bounding_box >>> x_spec = ([-92,92], 93) # voxels of size 2 in x, starting at -92, ending at 92 >>> z_spec = ([-70,100], 86) # voxels of size 2 in z, starting at -70, ending at 100 ->>> y70 = yslice(70, x_spec, z_spec, 'world-LPI') + +When specifying a *y* slice - we have to know what "y" means. In order for "y" +to have meaning, we need to specify the name of an output (range) space that has +a defined "y". In this case we use MNI space: + +>>> y70 = yslice(70, x_spec, z_spec, 'mni') >>> y70 AffineTransform( function_domain=CoordinateSystem(coord_names=('i_x', 'i_z'), name='slice', coord_dtype=float64), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='world-LPI', coord_dtype=float64), + function_range=CoordinateSystem(coord_names=('mni-x=L->R', 'mni-y=P->A', 'mni-z=I->S'), name='mni', coord_dtype=float64), affine=array([[ 2., 0., -92.], [ 0., 0., 70.], [ 0., 2., -70.], @@ -505,7 +496,7 @@ AffineTransform( ) >>> bounding_box(y70, (x_spec[1], z_spec[1])) - ([-92.0, 92.0], [70.0, 70.0], [-70.0, 100.0]) +((-92.0, 92.0), (70.0, 70.0), (-70.0, 100.0)) Maybe these aren't things that "normal human beings" (to steal a quote from Gael) can use, but they're explicit and they are tied to precise mathematical @@ -619,7 +610,6 @@ left to right or the technician looking at him, :) For this, I'm sure there's a standard answer, and it's likely the patient, but heck, I'm just a statistician so I don't know the answer. - (every volume has an ijkToRAS affine transform). We convert to/from LPS when calling ITK code, e.g., for I/O. @@ -632,8 +622,8 @@ something like this: >>> ijk_to_RAS = AffineTransform(ijk, RAS, T) >>> ijk_to_RAS AffineTransform( - function_domain=CoordinateSystem(coord_names=('i', 'j', 'k'), name='', coord_dtype=float64), - function_range=CoordinateSystem(coord_names=('R', 'A', 'S'), name='', coord_dtype=float64), + function_domain=CoordinateSystem(coord_names=('i', 'j', 'k'), name='voxel', coord_dtype=float64), + function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='world-RAS', coord_dtype=float64), affine=array([[ 2. , 0. , 0. , -91.095], [ 0. , 2. , 0. , -129.51 ], [ 0. , 0. , 2. , -73.25 ], @@ -641,7 +631,7 @@ AffineTransform( ) >>> LPS = CoordinateSystem('xyz', 'world-LPS') ->>> RAS_to_LPS = AffineTransform(RAS, LPS, np.diag([-1,-1,1,1])) +>>> RAS_to_LPS = AffineTransform(RAS, LPS, np.diag([-1,-1,1,1])) >>> ijk_to_LPS = compose(RAS_to_LPS, ijk_to_RAS) >>> RAS_to_LPS AffineTransform( @@ -677,37 +667,38 @@ acknowledge there are two coordinate systems :)) Once you've transposed the array, say +>>> data = np.random.normal(size=(10, 12, 14)) # original array >>> newdata = data.transpose([2,0,1]) You shouldn't use something called "ijk_to_RAS" or "ijk_to_LPS" transform. Rather, you should use a "kij_to_RAS" or "kij_to_LPS" transform. ->>> kji = CoordinateSystem('kji') +>>> ijk = CoordinateSystem('ijk', 'voxel') +>>> kij = CoordinateSystem('kij', 'voxel') >>> ijk_to_kij = AffineTransform(ijk, kij, np.array([[0,0,1,0],[1,0,0,0],[0,1,0,0],[0,0,0,1]])) ->>> import sympy ->>> # Check that it does the right permutation ->>> i, j, k = [sympy.Symbol(s) for s in 'ijk'] ->>> ijk_to_kij([i,j,k]) -array([k, i, j], dtype=object) ->>> # Yup, now let's try to make a kij_to_RAS transform ->>> # At first guess, we might try ->>> kij_to_RAS = compose(ijk_to_RAS,ijk_to_kij) ------------------------------------------------------------- + +Check that it does the right permutation + +>>> i, j, k = 10., 20., 40 +>>> ijk_to_kij([i, j, k]) +array([ 40., 10., 20.]) + +Yup, now let's try to make a kij_to_RAS transform + +At first guess, we might try + +>>> kij_to_RAS = compose(ijk_to_RAS, ijk_to_kij) Traceback (most recent call last): - File "", line 1, in - File "reference/coordinate_map.py", line 1090, in compose - return _compose_affines(*cmaps) - File "reference/coordinate_map.py", line 1417, in _compose_affines - raise ValueError("domains and ranges don't match up correctly") + ... ValueError: domains and ranges don't match up correctly ->>> # but we have a problem, we've asked for a composition that doesn't make sense +We have a problem, we've asked for a composition that doesn't make sense. If you're good with permutation matrices, you wouldn't have to call "compose" above and you can just do matrix multiplication. But here the name of the function tells you that yes, you should do the inverse: "ijk_to_kij" says that the range are "kij" values, but to get a "transform" for your data in "kij" it -should have a domain that is "kij" so it should be +should have a domain that is "kij". The call to compose raised an exception because it saw you were trying to compose a function with domain="ijk" and range="kji" with a function (on its @@ -715,10 +706,10 @@ left) having domain="ijk" and range "kji". This composition just doesn't make sense so it raises an exception. >>> kij_to_ijk = ijk_to_kij.inverse() ->>> kij_to_RAS = compose(ijk_to_RAS,kij_to_ijk) +>>> kij_to_RAS = compose(ijk_to_RAS, kij_to_ijk) >>> kij_to_RAS AffineTransform( - function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=float64), + function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='voxel', coord_dtype=float64), function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='world-RAS', coord_dtype=float64), affine=array([[ 0. , 2. , 0. , -91.095], [ 0. , 0. , 2. , -129.51 ], @@ -728,20 +719,16 @@ AffineTransform( >>> ijk_to_RAS([i,j,k]) -array([-91.095 + 2.0*i, -129.51 + 2.0*j, -73.25 + 2.0*k], dtype=object) +array([-71.095, -89.51 , 6.75 ]) >>> kij_to_RAS([k,i,j]) -array([-91.095 + 2.0*i, -129.51 + 2.0*j, -73.25 + 2.0*k], dtype=object) ->>> ->>> another_kij_to_RAS([k,i,j]) -array([-91.095 + 2.0*i, -129.51 + 2.0*j, -73.25 + 2.0*k], dtype=object) +array([-71.095, -89.51 , 6.75 ]) We also shouldn't have to rely on the names of the AffineTransforms, i.e. ijk_to_RAS, to remember what's what (in typing this example, I mixed up kij and -kji many times). The three objects ijk_to_RAS, kij_to_RAS and another_kij_to_RAS -all represent the same "affine transform", as evidenced by their output above. -There are lots of representations of the same "affine transform": -(6=permutations of i,j,k)*(6=permutations of x,y,z)=36 matrices for one "affine -transform". +kji many times). The objects ijk_to_RAS, kij_to_RAS represent the same "affine +transform", as evidenced by their output above. There are lots of +representations of the same "affine transform": (6=permutations of +i,j,k)*(6=permutations of x,y,z)=36 matrices for one "affine transform". If we throw in ambiguity about the sign in front of the output, there are 36*(8=2^3 possible flips of the x,y,z)=288 matrices possible but there are only @@ -757,74 +744,78 @@ as you reorder the 'ijk' and the 'RAS'. (Note that this code won't work in general because I had temporarily disabled a check in CoordinateSystem that enforced the dtype of the array to be a builtin scalar dtype for sanity's sake). To me, each of A, A_kij and A_kij_yzx below represent the same "transform" -because if I substitue i=30, j=40, k=50 and I know the order of the 'xyz' in the +because if I substitute i=30, j=40, k=50 and I know the order of the 'xyz' in the output then they will all give me the same answer. - >>> ijk = CoordinateSystem('ijk', coord_dtype=np.array(sympy.Symbol('x')).dtype) - >>> xyz = CoordinateSystem('xyz', coord_dtype=np.array(sympy.Symbol('x')).dtype) - >>> x_start, y_start, z_start = [sympy.Symbol(s) for s in ['x_start', 'y_start', 'z_start']] - >>> x_step, y_step, z_step = [sympy.Symbol(s) for s in ['x_step', 'y_step', 'z_step']] - >>> i, j, k = [sympy.Symbol(s) for s in 'ijk'] - >>> T = np.array([[x_step,0,0,x_start],[0,y_step,0,y_start],[0,0,z_step,z_start],[0,0,0,1]]) - >>> T - array([[x_step, 0, 0, x_start], - [0, y_step, 0, y_start], - [0, 0, z_step, z_start], - [0, 0, 0, 1]], dtype=object) - >>> A = AffineTransform(ijk, xyz, T) - >>> A - AffineTransform( - function_domain=CoordinateSystem(coord_names=('i', 'j', 'k'), name='', coord_dtype=object), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object), - affine=array([[x_step, 0, 0, x_start], - [0, y_step, 0, y_start], - [0, 0, z_step, z_start], - [0, 0, 0, 1]], dtype=object) - ) - >>> A([i,j,k]) - array([x_start + i*x_step, y_start + j*y_step, z_start + k*z_step], dtype=object) - >>> # this is another - >>> A_kij = A.reordered_domain('kij') +>>> import sympy +>>> ijk = CoordinateSystem('ijk', coord_dtype=np.array(sympy.Symbol('x')).dtype) +>>> xyz = CoordinateSystem('xyz', coord_dtype=np.array(sympy.Symbol('x')).dtype) +>>> x_start, y_start, z_start = [sympy.Symbol(s) for s in ['x_start', 'y_start', 'z_start']] +>>> x_step, y_step, z_step = [sympy.Symbol(s) for s in ['x_step', 'y_step', 'z_step']] +>>> i, j, k = [sympy.Symbol(s) for s in 'ijk'] +>>> T = np.array([[x_step,0,0,x_start],[0,y_step,0,y_start],[0,0,z_step,z_start],[0,0,0,1]]) +>>> T +array([[x_step, 0, 0, x_start], + [0, y_step, 0, y_start], + [0, 0, z_step, z_start], + [0, 0, 0, 1]], dtype=object) +>>> A = AffineTransform(ijk, xyz, T) +>>> A +AffineTransform( + function_domain=CoordinateSystem(coord_names=('i', 'j', 'k'), name='', coord_dtype=object), + function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object), + affine=array([[x_step, 0, 0, x_start], + [0, y_step, 0, y_start], + [0, 0, z_step, z_start], + [0, 0, 0, 1]], dtype=object) +) +>>> A([i,j,k]) == [x_start + i*x_step, y_start + j*y_step, z_start + k*z_step] +array([ True, True, True], dtype=bool) - >>> A_kij - AffineTransform( - function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=object), - function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object), - affine=array([[0, x_step, 0, x_start], - [0, 0, y_step, y_start], - [z_step, 0, 0, z_start], - [0.0, 0.0, 0.0, 1.0]], dtype=object) - ) - >>> - >>> A_kij([k,i,j]) - array([x_start + i*x_step, y_start + j*y_step, z_start + k*z_step], dtype=object) - >>> # let's look at another reordering - >>> A_kij_yzx = A_kij.reordered_range('yzx') - >>> A_kij_yzx - AffineTransform( - function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=object), - function_range=CoordinateSystem(coord_names=('y', 'z', 'x'), name='', coord_dtype=object), - affine=array([[0, 0, y_step, y_start], - [z_step, 0, 0, z_start], - [0, x_step, 0, x_start], - [0, 0, 0, 1.00000000000000]], dtype=object) - ) - >>> A_kij_yzx([k,i,j]) - array([y_start + j*y_step, z_start + k*z_step, x_start + i*x_step], dtype=object) - >>> +This is another + +>>> A_kij = A.reordered_domain('kij') +>>> A_kij +AffineTransform( + function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=object), + function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object), + affine=array([[0, 1.0*x_step, 0, 1.0*x_start], + [0, 0, 1.0*y_step, 1.0*y_start], + [1.0*z_step, 0, 0, 1.0*z_start], + [0.0, 0.0, 0.0, 1.0]], dtype=object) +) +>>> A_kij([k,i,j]) +array([1.0*i*x_step + 1.0*x_start, 1.0*j*y_step + 1.0*y_start, + 1.0*k*z_step + 1.0*z_start], dtype=object) + +Let's look at another reordering: + +>>> A_kij_yzx = A_kij.reordered_range('yzx') +>>> A_kij_yzx +AffineTransform( + function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=object), + function_range=CoordinateSystem(coord_names=('y', 'z', 'x'), name='', coord_dtype=object), + affine=array([[0, 0, 1.0*y_step, 1.0*y_start], + [1.0*z_step, 0, 0, 1.0*z_start], + [0, 1.0*x_step, 0, 1.0*x_start], + [0, 0, 0, 1.00000000000000]], dtype=object) +) +>>> A_kij_yzx([k,i,j]) +array([1.0*j*y_step + 1.0*y_start, 1.0*k*z_step + 1.0*z_start, + 1.0*i*x_step + 1.0*x_start], dtype=object) >>> A_kij AffineTransform( function_domain=CoordinateSystem(coord_names=('k', 'i', 'j'), name='', coord_dtype=object), function_range=CoordinateSystem(coord_names=('x', 'y', 'z'), name='', coord_dtype=object), - affine=array([[0, x_step, 0, x_start], - [0, 0, y_step, y_start], - [z_step, 0, 0, z_start], + affine=array([[0, 1.0*x_step, 0, 1.0*x_start], + [0, 0, 1.0*y_step, 1.0*y_start], + [1.0*z_step, 0, 0, 1.0*z_start], [0.0, 0.0, 0.0, 1.0]], dtype=object) ) +>>> from nipy.core.reference.coordinate_map import equivalent >>> equivalent(A_kij, A) True >>> equivalent(A_kij, A_kij_yzx) True - diff --git a/doc/users/basic_io.rst b/doc/users/basic_io.rst index dbe22e3ae5..0e41d3e117 100644 --- a/doc/users/basic_io.rst +++ b/doc/users/basic_io.rst @@ -76,6 +76,7 @@ AffineTransform( [ 0., 2., 0., -40.], [ 0., 0., 2., -16.], [ 0., 0., 0., 1.]]) +) See :ref:`coordinate_map` for more detail. diff --git a/doc/users/glm_spec.rst b/doc/users/glm_spec.rst index 7b8b082f8d..46f22b6ac3 100644 --- a/doc/users/glm_spec.rst +++ b/doc/users/glm_spec.rst @@ -28,7 +28,7 @@ We first begin by describing typically encountered fMRI designs. * Continuous stimuli, i.e. a rotating checkerboard -* Events with amplitiudes, i.e. non-categorical values +* Events with amplitudes, i.e. non-categorical values * Events with random amplitudes @@ -257,8 +257,11 @@ Thus, the cumulative neuronal model can be expressed as .. testcode:: from sympy import Symbol, Heaviside - ta = [0,4,8,12,16]; tb = [2,6,10,14,18] - ba = Symbol('ba'); bb = Symbol('bb') + t = Symbol('t') + ta = [0,4,8,12,16] + tb = [2,6,10,14,18] + ba = Symbol('ba') + bb = Symbol('bb') fa = sum([Heaviside(t-_t) for _t in ta]) * ba fb = sum([Heaviside(t-_t) for _t in tb]) * bb N = fa+fb @@ -272,13 +275,17 @@ the same :math:`f` above), but the different experimental model :math:`E` yields .. testcode:: - from sympy import Symbol, Heaviside + from sympy import Symbol, Heaviside, Piecewise ta = [0,4,8,12,16]; tb = [2,6,10,14,18] ba = Symbol('ba'); bb = Symbol('bb') fa = sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t >= _t+0.5))) for _t in ta])*ba fb = sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t >= _t+0.5))) for _t in tb])*bb N = fa+fb - print N + print(N) + +.. testoutput:: + + ba*(Piecewise((0, t < 0), (2.0*t, t < 0.5), (1, t >= 0.5)) + Piecewise((0, t < 4), (2.0*t - 8.0, t < 4.5), (1, t >= 4.5)) + Piecewise((0, t < 8), (2.0*t - 16.0, t < 8.5), (1, t >= 8.5)) + Piecewise((0, t < 12), (2.0*t - 24.0, t < 12.5), (1, t >= 12.5)) + Piecewise((0, t < 16), (2.0*t - 32.0, t < 16.5), (1, t >= 16.5))) + bb*(Piecewise((0, t < 2), (2.0*t - 4.0, t < 2.5), (1, t >= 2.5)) + Piecewise((0, t < 6), (2.0*t - 12.0, t < 6.5), (1, t >= 6.5)) + Piecewise((0, t < 10), (2.0*t - 20.0, t < 10.5), (1, t >= 10.5)) + Piecewise((0, t < 14), (2.0*t - 28.0, t < 14.5), (1, t >= 14.5)) + Piecewise((0, t < 18), (2.0*t - 36.0, t < 18.5), (1, t >= 18.5))) Or, graphically, if we set :math:`\beta_a=1` and :math:`\beta_b=-2`, as @@ -318,10 +325,13 @@ terms of delta functions t = Symbol('t') ba = Symbol('ba') fa = sum([Heaviside(t-_t) for _t in ta]) * ba - print fa.diff(t) + print(fa.diff(t)) -.. plot:: users/plots/hrf_delta.py +.. testoutput:: + + ba*(DiracDelta(t) + DiracDelta(t - 16) + DiracDelta(t - 12) + DiracDelta(t - 8) + DiracDelta(t - 4)) +.. plot:: users/plots/hrf_delta.py Convolution =========== @@ -440,13 +450,11 @@ group :math:`b`. This yields a hemodynamic model .. testcode:: from nipy.modalities.fmri import hrf - glover = hrf.glover_sympy - afni = hrf.afni_sympy ta = [0,4,8,12,16]; tb = [2,6,10,14,18] ba = 1; bb = -2 - na = ba * sum([glover(hrf.t - t) for t in ta]) - nb = bb * sum([afni(hrf.t - t) for t in tb]) + na = ba * sum([hrf.glover(hrf.T - t) for t in ta]) + nb = bb * sum([hrf.afni(hrf.T - t) for t in tb]) n = na + nb .. plot:: users/plots/hrf_different.py @@ -460,14 +468,13 @@ HRF yields a hemodynamic model .. testcode:: - from nipy.modalities.fmri.utils import events, Symbol - from nipy.modalities.fmri.hrf import glover_sympy import numpy as np + from nipy.modalities.fmri.utils import events, Symbol a = Symbol('a') b = np.linspace(0,50,6) amp = b*([-1,1]*3) - d = events(b, amplitudes=amp, g=a+0.5*a**2, f=glover_sympy) + d = events(b, amplitudes=amp, g=a+0.5*a**2, f=hrf.glover) .. plot:: users/plots/event_amplitude.py diff --git a/doc/users/math_coordmap.rst b/doc/users/math_coordmap.rst index 981e1c6c23..163f5e0e88 100644 --- a/doc/users/math_coordmap.rst +++ b/doc/users/math_coordmap.rst @@ -373,9 +373,14 @@ Going from this mathematical description to code is fairly straightforward. course, the function :math:`f` can be recovered as :math:`f` = I_R^{-1} \circ \tilde{f} I_D`. In code, :math:`f` is roughly equivalent to: + >>> from nipy.core.api import CoordinateMap, CoordinateSystem + >>> in_cs = CoordinateSystem('ijk', 'voxels') + >>> out_cs = CoordinateSystem('xyz', 'mm') + >>> map = lambda x : x + 1 + >>> coordmap = CoordinateMap(in_cs, out_cs, map) >>> domain = coordmap.function_domain >>> range = coordmap.function_range - >>> f_tilde = coordmap.mapping + >>> f_tilde = coordmap.function >>> in_dtype = domain.coord_dtype >>> out_dtype = range.dtype From f96a694b9c6fb0b962e128d1f8e630644e5bf10a Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 16 Jan 2013 00:27:51 +0000 Subject: [PATCH 094/164] TST: remove yields in coordinate_system tests Remove use of generators in tests to make them easier to debug --- .../reference/tests/test_coordinate_system.py | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/nipy/core/reference/tests/test_coordinate_system.py b/nipy/core/reference/tests/test_coordinate_system.py index 404770247e..adf24415ef 100644 --- a/nipy/core/reference/tests/test_coordinate_system.py +++ b/nipy/core/reference/tests/test_coordinate_system.py @@ -39,9 +39,9 @@ def gen(): def test_ndim(): cs = CoordinateSystem('xy') - yield assert_equal, cs.ndim, 2 + assert_equal(cs.ndim, 2) cs = CoordinateSystem('ijk') - yield assert_equal, cs.ndim, 3 + assert_equal(cs.ndim, 3) def test_unique_coord_names(): @@ -56,48 +56,48 @@ def test_dtypes(): # invalid dtypes dtypes = np.sctypes['others'] for dt in dtypes: - yield assert_raises, ValueError, CoordinateSystem, 'ijk', 'test', dt + assert_raises(ValueError, CoordinateSystem, 'ijk', 'test', dt) # compound dtype dtype = np.dtype([('field1', ' Date: Wed, 16 Jan 2013 00:44:48 +0000 Subject: [PATCH 095/164] RF: allow object coordinate in coordinate system Objects as coordinate values can be useful for sympy expressions as coordinates. Objects can often be subtracted, compared etc. In fact we already use objects as a coordinate type in the documentation. --- nipy/core/reference/coordinate_system.py | 14 +++++++------- .../core/reference/tests/test_coordinate_system.py | 14 ++++++++++---- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/nipy/core/reference/coordinate_system.py b/nipy/core/reference/coordinate_system.py index 0eb643c90b..73e44b3626 100644 --- a/nipy/core/reference/coordinate_system.py +++ b/nipy/core/reference/coordinate_system.py @@ -114,7 +114,7 @@ def __init__(self, coord_names, name='', coord_dtype=np.float): raise ValueError('coord_names must have distinct names') # verify that the dtype is coord_dtype for sanity sctypes = (np.sctypes['int'] + np.sctypes['float'] + - np.sctypes['complex'] + np.sctypes['uint']) + np.sctypes['complex'] + np.sctypes['uint'] + [np.object]) coord_dtype = np.dtype(coord_dtype) if coord_dtype not in sctypes: raise ValueError('Coordinate dtype should be one of %s' % sctypes) @@ -123,7 +123,7 @@ def __init__(self, coord_names, name='', coord_dtype=np.float): self.coord_names = coord_names self.coord_dtype = coord_dtype self.ndim = len(coord_names) - self.dtype = np.dtype([(name, self.coord_dtype) + self.dtype = np.dtype([(name, self.coord_dtype) for name in self.coord_names]) # All attributes are read only @@ -341,7 +341,7 @@ def safe_dtype(*dtypes): >>> safe_dtype(type('foo')) Traceback (most recent call last): ... - TypeError: dtype must be valid numpy dtype bool, int, uint, float or complex + TypeError: dtype must be valid numpy dtype int, uint, float, complex or object >>> # Check for a valid dtype >>> myarr = np.zeros(2, np.float32) @@ -356,13 +356,13 @@ def safe_dtype(*dtypes): >>> safe_dtype(mydtype) Traceback (most recent call last): ... - TypeError: dtype must be valid numpy dtype bool, int, uint, float or complex + TypeError: dtype must be valid numpy dtype int, uint, float, complex or object """ arrays = [np.zeros(2, dtype) for dtype in dtypes] kinds = [a.dtype.kind for a in arrays] - if not set(kinds).issubset('iubfc'): - raise TypeError('dtype must be valid numpy dtype bool, ' - 'int, uint, float or complex') + if not set(kinds).issubset('iubfcO'): + raise TypeError('dtype must be valid numpy dtype ' + 'int, uint, float, complex or object') return np.array(arrays).dtype diff --git a/nipy/core/reference/tests/test_coordinate_system.py b/nipy/core/reference/tests/test_coordinate_system.py index adf24415ef..081f6d54c4 100644 --- a/nipy/core/reference/tests/test_coordinate_system.py +++ b/nipy/core/reference/tests/test_coordinate_system.py @@ -55,18 +55,24 @@ def test_unique_coord_names(): def test_dtypes(): # invalid dtypes dtypes = np.sctypes['others'] + dtypes.remove(np.object) for dt in dtypes: assert_raises(ValueError, CoordinateSystem, 'ijk', 'test', dt) # compound dtype dtype = np.dtype([('field1', ' Date: Wed, 16 Jan 2013 21:37:00 +0000 Subject: [PATCH 096/164] RF: allow coordinate map to work with object dtype Coordinate maps can sensibly have object dtypes in the coordinate system, such as sympy symbols. Take these into account for inverses, permutations. The inverse of an AffineTransform previously could have a different coordinate input / output type from the original. Constrain to have the same coordinate types, return None for inverse otherwise. Adapt the doctest for __call__ to reflect this. --- nipy/core/reference/coordinate_map.py | 56 +++++++++++------- .../reference/tests/test_coordinate_map.py | 58 +++++++++++++++++++ 2 files changed, 94 insertions(+), 20 deletions(-) diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index 9cfcf88eaa..2086471966 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -64,6 +64,7 @@ import warnings import numpy as np +import numpy.linalg as npl from nibabel.affines import to_matvec, from_matvec from ...fixes.nibabel import io_orientation @@ -572,14 +573,30 @@ def __init__(self, function_domain, function_range, affine): ################################################################### def inverse(self): - """ Return inverse affine transform or None if not invertible + """ Return coordinate map with inverse affine transform or None + + Try to invert our ``affine``, and see if it can be cast to the needed + data type, which is ``self.function_domain.coord_dtype``. We need this + dtype in order for the inverse to preserve the coordinate system dtypes. """ + aff_dt = self.function_range.coord_dtype try: - return AffineTransform(self.function_range, - self.function_domain, - np.linalg.inv(self.affine)) - except np.linalg.linalg.LinAlgError: + m_inv_in = npl.inv(self.affine) + except npl.LinAlgError: return None + except TypeError: + # Try using sympy for the inverse. This might be needed for sympy + # symbols in the affine, or Float128 + from sympy import Matrix, matrix2numpy + sym_inv = Matrix(self.affine).inv() + m_inv = matrix2numpy(sym_inv).astype(aff_dt) + else: # linalg inverse succeeded - can we cast back? + m_inv = m_inv_in.astype(aff_dt) + if (aff_dt != np.object) and not np.allclose(m_inv_in, m_inv): + return None + return AffineTransform(self.function_range, + self.function_domain, + m_inv) ################################################################### # @@ -883,10 +900,8 @@ def __call__(self, x): >>> affine_transform([2,3,4]) #doctest: +IGNORE_DTYPE array([3, 4, 5]) >>> affine_transform_inv = affine_transform.inverse() - >>> # Its inverse has a matrix of np.float - >>> # because np.linalg.inv was called. - >>> affine_transform_inv([2,6,12]) - array([ 1., 5., 11.]) + >>> affine_transform_inv([2, 6, 12]) + array([ 1, 5, 11]) """ x = np.asanyarray(x) out_shape = (self.function_range.ndim,) @@ -940,14 +955,15 @@ def __repr__(self): '\n '.join(repr(self.affine).split('\n')))) def __eq__(self, other): - test1, test2, test3, test4 =(isinstance(other, self.__class__), - np.allclose(self.affine, other.affine), - (self.function_domain == - other.function_domain), - (self.function_range == - other.function_range)) - value = test1 and test2 and test3 and test4 - return value + # Must be subclasses + if not isinstance(other, self.__class__): + return False + if np.any(self.affine - other.affine): # for objects + if not np.allclose(self.affine, other.affine): # for numerical + return False + if not self.function_domain == other.function_domain: + return False + return self.function_range == other.function_range def __ne__(self, other): return not self.__eq__(other) @@ -1138,13 +1154,13 @@ def reordered_domain(mapping, order=None): for i, j in enumerate(order): perm[j,i] = 1. - perm = perm.astype(mapping.function_domain.coord_dtype) - # If there is no reordering, return mapping if np.allclose(perm, np.identity(perm.shape[0])): import copy return copy.copy(mapping) + perm = perm.astype(mapping.function_domain.coord_dtype) + A = AffineTransform(newincoords, mapping.function_domain, perm) if isinstance(mapping, AffineTransform): return _compose_affines(mapping, A) @@ -1444,11 +1460,11 @@ def reordered_range(mapping, order=None): for i, j in enumerate(order): perm[j,i] = 1. - perm = perm.astype(mapping.function_range.coord_dtype) if np.allclose(perm, np.identity(perm.shape[0])): import copy return copy.copy(mapping) + perm = perm.astype(mapping.function_range.coord_dtype) A = AffineTransform(mapping.function_range, newoutcoords, perm.T) diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index 5851b251a3..fd058438ee 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -1,5 +1,7 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from copy import copy + import numpy as np # this import line is a little ridiculous... @@ -931,3 +933,59 @@ def test_make_cmap(): [0,0,4,0], [0,0,0,1]]) assert_equal(cmm.make_affine(aff, 4), AffineTransform(dcs, rcs, exp_aff)) + + +def test_dtype_cmap_inverses(): + # Check that we can make functional inverses of AffineTransforms, and + # CoordinateMap versions of AffineTransforms + dtypes = (np.sctypes['int'] + np.sctypes['float'] + np.sctypes['complex'] + + [np.object]) + arr_p1 = np.eye(4)[:, [0, 2, 1, 3]] + in_arr = [0, 1, 2] + out_arr = [0, 2, 1] + for dt in dtypes: + in_cs = CoordinateSystem('ijk', coord_dtype=dt) + out_cs = CoordinateSystem('xyz', coord_dtype=dt) + cmap = AffineTransform(in_cs, out_cs, arr_p1.astype(dt)) + r_cmap = cmap.inverse() + assert_array_equal(r_cmap.affine, arr_p1) + cm_cmap = _as_coordinate_map(cmap) + coord = np.array(in_arr, dtype=dt) + assert_array_equal(cm_cmap(coord), out_arr) + rcm_cmap = cm_cmap.inverse() + assert_array_equal(rcm_cmap(coord), out_arr) + + +def test_cmap_coord_types(): + # Check that we can use full range of coordinate system types. The inverse + # of an AffineTransform should generate coordinates in the input coordinate + # system dtype + dtypes = (np.sctypes['int'] + np.sctypes['float'] + np.sctypes['complex'] + + [np.object]) + arr_p1 = np.eye(4) + arr_p1[:3, 3] = 1 + for dt in dtypes: + in_cs = CoordinateSystem('ijk', coord_dtype=dt) + out_cs = CoordinateSystem('xyz', coord_dtype=dt) + # CoordinateMap + cmap = CoordinateMap(in_cs, out_cs, lambda x : x + 1) + assert_equal(cmap, copy(cmap)) + res = cmap(np.array([0, 1, 2], dtype=dt)) + assert_array_equal(res, [1, 2, 3]) + assert_equal(res.dtype, in_cs.coord_dtype) + # Check reordering works + rcmap = cmap.reordered_domain('ikj').reordered_range('yxz') + res = rcmap(np.array([0, 1, 2], dtype=dt)) + assert_array_equal(res, [3, 1, 2]) + assert_equal(res.dtype, in_cs.coord_dtype) + # AffineTransform + cmap = AffineTransform(in_cs, out_cs, arr_p1.astype(dt)) + res = cmap(np.array([0, 1, 2], dtype=dt)) + assert_array_equal(res, [1, 2, 3]) + assert_equal(res.dtype, in_cs.coord_dtype) + assert_equal(cmap, copy(cmap)) + # Check reordering works + rcmap = cmap.reordered_domain('ikj').reordered_range('yxz') + res = rcmap(np.array([0, 1, 2], dtype=dt)) + assert_array_equal(res, [3, 1, 2]) + assert_equal(res.dtype, in_cs.coord_dtype) From 5dc0d33c0ddacc72a747146ac536520e109ee5f5 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 16 Jan 2013 21:41:59 +0000 Subject: [PATCH 097/164] BF: allow CoordinateMap subclasses on L & R of == We were previously only testing subclasses in one direction, but a subclass on the left or the right should be OK. Test. --- nipy/core/reference/coordinate_map.py | 6 ++++-- .../core/reference/tests/test_coordinate_map.py | 17 +++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index 2086471966..f660b3400f 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -442,7 +442,8 @@ def _checkfunction(self): out = self(inp) def __eq__(self, other): - return (isinstance(other, self.__class__) + return ((isinstance(other, self.__class__) or + isinstance(self, other.__class__)) and (self.function == other.function) and (self.function_domain == other.function_domain) @@ -956,7 +957,8 @@ def __repr__(self): def __eq__(self, other): # Must be subclasses - if not isinstance(other, self.__class__): + if not (isinstance(other, self.__class__) or + isinstance(self, other.__class__)): return False if np.any(self.affine - other.affine): # for objects if not np.allclose(self.affine, other.affine): # for numerical diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index fd058438ee..4ea5f5cb95 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -956,6 +956,23 @@ def test_dtype_cmap_inverses(): assert_array_equal(rcm_cmap(coord), out_arr) +def test_subtype_equalities(): + # Check cmap compare equal if subtypes, on either side + in_cs = CoordinateSystem('ijk') + out_cs = CoordinateSystem('xyz') + f = lambda x : x + 1 + cmap = CoordinateMap(in_cs, out_cs, f) + class CM2(CoordinateMap): pass + cmap2 = CM2(in_cs, out_cs, f) + assert_equal(cmap, cmap2) + assert_equal(cmap2, cmap) + cmap = AffineTransform(in_cs, out_cs, np.eye(4)) + class AT2(AffineTransform): pass + cmap2 = AT2(in_cs, out_cs, np.eye(4)) + assert_equal(cmap, cmap2) + assert_equal(cmap2, cmap) + + def test_cmap_coord_types(): # Check that we can use full range of coordinate system types. The inverse # of an AffineTransform should generate coordinates in the input coordinate From b2e2c13c39acd7e18a82e986c7576a1ee6c04bdc Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 18 Jan 2013 00:10:06 +0000 Subject: [PATCH 098/164] RF: refactor to restore previous inverse behavior Restore the previous behavior of returning a floating point inverse (mostly) from an int input AffineTransform. Add flag to inverse method to specify new behavior of returning None when no integer inverse can be found. --- nipy/core/reference/coordinate_map.py | 80 ++++++++++++++++--- .../reference/tests/test_coordinate_map.py | 67 +++++++++++++--- 2 files changed, 124 insertions(+), 23 deletions(-) diff --git a/nipy/core/reference/coordinate_map.py b/nipy/core/reference/coordinate_map.py index f660b3400f..31dc03254f 100644 --- a/nipy/core/reference/coordinate_map.py +++ b/nipy/core/reference/coordinate_map.py @@ -573,16 +573,69 @@ def __init__(self, function_domain, function_range, affine): # ################################################################### - def inverse(self): + def inverse(self, preserve_dtype=False): """ Return coordinate map with inverse affine transform or None - Try to invert our ``affine``, and see if it can be cast to the needed - data type, which is ``self.function_domain.coord_dtype``. We need this - dtype in order for the inverse to preserve the coordinate system dtypes. + Parameters + ---------- + preserve_dtype : bool + If False, return affine mapping from inverting the ``affine``. The + domain / range dtypes for the inverse may then change as a function + of the dtype of the inverted ``affine``. If True, try to invert our + ``affine``, and see if it can be cast to the needed data type, which + is ``self.function_domain.coord_dtype``. We need this dtype in + order for the inverse to preserve the coordinate system dtypes. + + Returns + ------- + aff_cm_inv : ``AffineTransform`` instance or None + ``AffineTransform`` mapping from the *range* of input `self` to the + *domain* of input `self` - the inverse of `self`. If + ``self.affine`` was not invertible return None. If `preserve_dtype` + is True, and the inverse of ``self.affine`` cannot be cast to + ``self.function_domain.coord_dtype``, then return None. Otherwise + return ``AffineTransform`` inverse mapping. If `preserve_dtype` is + False, the domain / range dtypes of the return inverse may well be + different from those of the input `self`. + + Examples + -------- + >>> input_cs = CoordinateSystem('ijk', coord_dtype=np.int) + >>> output_cs = CoordinateSystem('xyz', coord_dtype=np.int) + >>> affine = np.array([[1,0,0,1], + ... [0,1,0,1], + ... [0,0,1,1], + ... [0,0,0,1]]) + >>> affine_transform = AffineTransform(input_cs, output_cs, affine) + >>> affine_transform([2,3,4]) #doctest: +IGNORE_DTYPE + array([3, 4, 5]) + + The inverse transform, by default, generates a floating point inverse + matrix and therefore floating point output: + + >>> affine_transform_inv = affine_transform.inverse() + >>> affine_transform_inv([2, 6, 12]) + array([ 1., 5., 11.]) + + You can force it to preserve the coordinate system dtype with the + `preserve_dtype` flag: + + >>> at_inv_preserved = affine_transform.inverse(preserve_dtype=True) + >>> at_inv_preserved([2, 6, 12]) #doctest: +IGNORE_DTYPE + array([ 1, 5, 11]) + + If you `preserve_dtype`, and there is no inverse affine preserving the + dtype, the inverse is None: + + >>> affine2 = affine.copy() + >>> affine2[0, 0] = 2 # now inverse can't be integer + >>> aff_t = AffineTransform(input_cs, output_cs, affine2) + >>> aff_t.inverse(preserve_dtype=True) is None + True """ aff_dt = self.function_range.coord_dtype try: - m_inv_in = npl.inv(self.affine) + m_inv = npl.inv(self.affine) except npl.LinAlgError: return None except TypeError: @@ -591,10 +644,12 @@ def inverse(self): from sympy import Matrix, matrix2numpy sym_inv = Matrix(self.affine).inv() m_inv = matrix2numpy(sym_inv).astype(aff_dt) - else: # linalg inverse succeeded - can we cast back? - m_inv = m_inv_in.astype(aff_dt) - if (aff_dt != np.object) and not np.allclose(m_inv_in, m_inv): - return None + else: # linalg inverse succeeded + if preserve_dtype and aff_dt != np.object: # can we cast back? + m_inv_orig = m_inv + m_inv = m_inv.astype(aff_dt) + if not np.allclose(m_inv_orig, m_inv): + return None return AffineTransform(self.function_range, self.function_domain, m_inv) @@ -900,9 +955,6 @@ def __call__(self, x): >>> affine_transform = AffineTransform(input_cs, output_cs, affine) >>> affine_transform([2,3,4]) #doctest: +IGNORE_DTYPE array([3, 4, 5]) - >>> affine_transform_inv = affine_transform.inverse() - >>> affine_transform_inv([2, 6, 12]) - array([ 1, 5, 11]) """ x = np.asanyarray(x) out_shape = (self.function_range.ndim,) @@ -1567,7 +1619,9 @@ def _function(x): value += b return value - affine_transform_inv = affine_transform.inverse() + # Preserve dtype check because the CoordinateMap expects to generate the + # expected dtype and checks this on object creation + affine_transform_inv = affine_transform.inverse(preserve_dtype=True) if affine_transform_inv: Ainv, binv = to_matvec(affine_transform_inv.affine) def _inverse_function(x): diff --git a/nipy/core/reference/tests/test_coordinate_map.py b/nipy/core/reference/tests/test_coordinate_map.py index 4ea5f5cb95..49d9859eb9 100644 --- a/nipy/core/reference/tests/test_coordinate_map.py +++ b/nipy/core/reference/tests/test_coordinate_map.py @@ -938,22 +938,69 @@ def test_make_cmap(): def test_dtype_cmap_inverses(): # Check that we can make functional inverses of AffineTransforms, and # CoordinateMap versions of AffineTransforms - dtypes = (np.sctypes['int'] + np.sctypes['float'] + np.sctypes['complex'] + - [np.object]) + dtypes = (np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] + + np.sctypes['complex'] + [np.object]) arr_p1 = np.eye(4)[:, [0, 2, 1, 3]] - in_arr = [0, 1, 2] - out_arr = [0, 2, 1] + in_list = [0, 1, 2] + out_list = [0, 2, 1] for dt in dtypes: in_cs = CoordinateSystem('ijk', coord_dtype=dt) out_cs = CoordinateSystem('xyz', coord_dtype=dt) cmap = AffineTransform(in_cs, out_cs, arr_p1.astype(dt)) + coord = np.array(in_list, dtype=dt) + out_coord = np.array(out_list, dtype=dt) + # Expected output type of inverse, not preserving + if dt in np.sctypes['int'] + np.sctypes['uint']: + exp_i_dt = np.float64 + else: + exp_i_dt = dt + # Default inverse cmap may alter coordinate types r_cmap = cmap.inverse() - assert_array_equal(r_cmap.affine, arr_p1) + res = r_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, exp_i_dt) + # Default behavior is preserve_type=False + r_cmap = cmap.inverse(preserve_dtype=False) + res = r_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, exp_i_dt) + # Preserve_dtype=True - preserves dtype + r_cmap = cmap.inverse(preserve_dtype=True) + res = r_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, dt) + # Preserve_dtype=True is default for conversion to CoordinateMap cm_cmap = _as_coordinate_map(cmap) - coord = np.array(in_arr, dtype=dt) - assert_array_equal(cm_cmap(coord), out_arr) + assert_array_equal(cm_cmap(coord), out_list) rcm_cmap = cm_cmap.inverse() - assert_array_equal(rcm_cmap(coord), out_arr) + assert_array_equal(rcm_cmap(coord), out_list) + res = rcm_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, dt) + # For integer types, where there is no integer inverse, return floatey + # inverse by default, and None for inverse when preserve_dtype=True + arr_p2 = arr_p1 * 2 + arr_p2[-1, -1] = 1 + out_list = [0, 4, 2] + for dt in np.sctypes['int'] + np.sctypes['uint']: + in_cs = CoordinateSystem('ijk', coord_dtype=dt) + out_cs = CoordinateSystem('xyz', coord_dtype=dt) + cmap = AffineTransform(in_cs, out_cs, arr_p2.astype(dt)) + coord = np.array(in_list, dtype=dt) + out_coord = np.array(out_list, dtype=dt) + # Default + r_cmap = cmap.inverse() + res = r_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, np.float64) + # Default is preserve_type=False + r_cmap = cmap.inverse(preserve_dtype=False) + res = r_cmap(out_coord) + assert_array_equal(res, coord) + assert_equal(res.dtype, np.float64) + # preserve_dtype=True means there is no valid inverse for non integer + # affine inverses, as here + assert_equal(cmap.inverse(preserve_dtype=True), None) def test_subtype_equalities(): @@ -977,8 +1024,8 @@ def test_cmap_coord_types(): # Check that we can use full range of coordinate system types. The inverse # of an AffineTransform should generate coordinates in the input coordinate # system dtype - dtypes = (np.sctypes['int'] + np.sctypes['float'] + np.sctypes['complex'] + - [np.object]) + dtypes = (np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float'] + + np.sctypes['complex'] + [np.object]) arr_p1 = np.eye(4) arr_p1[:3, 3] = 1 for dt in dtypes: From b50c3169a60f856f8e1de01a8677fc33851ac9a3 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 18 Jan 2013 01:28:45 +0000 Subject: [PATCH 099/164] BF: fix travis yml file for build errors Travis seems to be timing out for the slow tests now. Run the not slow tests only. The sympy build command was not correct and it has probably been building the master up until now. Fix to build the latest release. --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8669463270..40c0b0ea98 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ install: - if [ "${PYSUF}" == "3" ]; then git clone git://github.com/sympy/sympy.git _sympy ; cd _sympy ; - git checkout -b 0.7.2 origin/0.7.2 ; + git checkout -b 0.7.2 sympy-0.7.2 ; python3 ./bin/use2to3 ; cd py3k-sympy ; sudo python3 setup.py install ; @@ -38,4 +38,4 @@ script: # Change into an innocuous directory and find tests from installation - mkdir for_test - cd for_test - - $PYTHON ../tools/nipnost `$PYTHON -c "import os; import nipy; print(os.path.dirname(nipy.__file__))"` + - $PYTHON ../tools/nipnost -A "not slow" `$PYTHON -c "import os; import nipy; print(os.path.dirname(nipy.__file__))"` From d915f892eb062636b029b97450b86d8dd16f6a1c Mon Sep 17 00:00:00 2001 From: VirgileFritsch Date: Fri, 18 Jan 2013 14:57:59 +0100 Subject: [PATCH 100/164] [BF] Fix bug in multiple_fast_inv. Some computations were done outside the loop, but they depend on values changing at each iteration. --- nipy/algorithms/statistics/utils.py | 39 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/nipy/algorithms/statistics/utils.py b/nipy/algorithms/statistics/utils.py index bab03a37b2..2853ed10e5 100644 --- a/nipy/algorithms/statistics/utils.py +++ b/nipy/algorithms/statistics/utils.py @@ -43,32 +43,31 @@ def multiple_fast_inv(a): from scipy.linalg import calc_lwork from scipy.linalg.lapack import get_lapack_funcs a1, n = a[0], a.shape[0] - getrf, getri = get_lapack_funcs(('getrf','getri'), (a1,)) - if getrf.module_name[:7] == 'clapack' != getri.module_name[:7]: - # ATLAS 3.2.1 has getrf but not getri. - for i in range(n): + getrf, getri = get_lapack_funcs(('getrf', 'getri'), (a1,)) + for i in range(n): + if getrf.module_name[:7] == 'clapack' != getri.module_name[:7]: + # ATLAS 3.2.1 has getrf but not getri. lu, piv, info = getrf(np.transpose(a[i]), rowmajor=0, overwrite_a=True) a[i] = np.transpose(lu) - else: - for i in range(n): + else: a[i], piv, info = getrf(a[i], overwrite_a=True) - if info == 0: - if getri.module_name[:7] == 'flapack': - lwork = calc_lwork.getri(getri.prefix, a1.shape[0]) - lwork = lwork[1] - # XXX: the following line fixes curious SEGFAULT when - # benchmarking 500x500 matrix inverse. This seems to - # be a bug in LAPACK ?getri routine because if lwork is - # minimal (when using lwork[0] instead of lwork[1]) then - # all tests pass. Further investigation is required if - # more such SEGFAULTs occur. - lwork = int(1.01 * lwork) - for i in range(n): + if info == 0: + if getri.module_name[:7] == 'flapack': + lwork = calc_lwork.getri(getri.prefix, a1.shape[0]) + lwork = lwork[1] + # XXX: the following line fixes curious SEGFAULT when + # benchmarking 500x500 matrix inverse. This seems to + # be a bug in LAPACK ?getri routine because if lwork is + # minimal (when using lwork[0] instead of lwork[1]) then + # all tests pass. Further investigation is required if + # more such SEGFAULTs occur. + lwork = int(1.01 * lwork) a[i], _ = getri(a[i], piv, lwork=lwork, overwrite_lu=1) - else: # clapack - for i in range(n): + else: # clapack a[i], _ = getri(a[i], piv, overwrite_lu=1) + else: + raise ValueError('Matrix LU decomposition failed') return a From 5d52c2e48866b7645289ef6cd8a22ef05e912c61 Mon Sep 17 00:00:00 2001 From: VirgileFritsch Date: Tue, 22 Jan 2013 10:17:08 +0100 Subject: [PATCH 101/164] Add test for multiple_fast_inv. That test would fail with earlier versions of the routine. --- nipy/algorithms/statistics/tests/test_utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nipy/algorithms/statistics/tests/test_utils.py b/nipy/algorithms/statistics/tests/test_utils.py index c6440fa807..a95826909a 100644 --- a/nipy/algorithms/statistics/tests/test_utils.py +++ b/nipy/algorithms/statistics/tests/test_utils.py @@ -3,7 +3,7 @@ import numpy as np from scipy.stats import norm -from ..utils import multiple_mahalanobis, z_score +from ..utils import multiple_mahalanobis, z_score, multiple_fast_inv from nose.tools import assert_true from numpy.testing import assert_almost_equal, assert_array_almost_equal @@ -31,6 +31,16 @@ def test_mahalanobis2(): f_mah = (multiple_mahalanobis(x, Aa))[i] assert_true(np.allclose(mah, f_mah)) +def test_multiple_fast_inv(): + shape = (10, 20, 20) + X = np.random.randn(shape[0], shape[1], shape[2]) + X_inv_ref = np.zeros(shape) + for i in range(shape[0]): + X[i] = np.dot(X[i], X[i].T) + X_inv_ref[i] = np.linalg.inv(X[i]) + X_inv = multiple_fast_inv(X) + assert_almost_equal(X_inv_ref, X_inv) + if __name__ == "__main__": import nose From cb53c6fed0bf3a4e2479b2905f63626e41e44f82 Mon Sep 17 00:00:00 2001 From: VirgileFritsch Date: Tue, 22 Jan 2013 10:32:47 +0100 Subject: [PATCH 102/164] Cosmit: Syntax simplification in multiple_fast_inv. This helps better understanding what is the code logic. I do not think it can be further factorized yet. --- nipy/algorithms/statistics/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipy/algorithms/statistics/utils.py b/nipy/algorithms/statistics/utils.py index 2853ed10e5..07b011eb41 100644 --- a/nipy/algorithms/statistics/utils.py +++ b/nipy/algorithms/statistics/utils.py @@ -45,7 +45,8 @@ def multiple_fast_inv(a): a1, n = a[0], a.shape[0] getrf, getri = get_lapack_funcs(('getrf', 'getri'), (a1,)) for i in range(n): - if getrf.module_name[:7] == 'clapack' != getri.module_name[:7]: + if (getrf.module_name[:7] == 'clapack' + and getri.module_name[:7] != 'clapack'): # ATLAS 3.2.1 has getrf but not getri. lu, piv, info = getrf(np.transpose(a[i]), rowmajor=0, overwrite_a=True) From 41540d6e02902e304bcd75907edce13ae164818c Mon Sep 17 00:00:00 2001 From: Yannick Schwartz Date: Fri, 18 Jan 2013 14:54:05 +0100 Subject: [PATCH 103/164] FMRILinearModel handles the case where contrasts are null for some fmri sessions --- nipy/modalities/fmri/glm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nipy/modalities/fmri/glm.py b/nipy/modalities/fmri/glm.py index 6f8a4bc3af..1794a9766e 100644 --- a/nipy/modalities/fmri/glm.py +++ b/nipy/modalities/fmri/glm.py @@ -32,6 +32,8 @@ import numpy as np +from warnings import warn + import scipy.stats as sps from nibabel import load, Nifti1Image @@ -561,8 +563,11 @@ def contrast(self, contrasts, con_id='', contrast_type=None, output_z=True, 'contrasts must be a sequence of %d session contrasts' % len(self.glms)) + contrast_ = None for i, (glm, con) in enumerate(zip(self.glms, contrasts)): - if i == 0: + if np.all(con == 0): + warn('Contrast for session %d is null' % i) + elif not contrast_: contrast_ = glm.contrast(con, contrast_type) else: contrast_ = contrast_ + glm.contrast(con, contrast_type) From 799bb80268d19910bd002ef0dd29fdfcecf034a5 Mon Sep 17 00:00:00 2001 From: Yannick Schwartz Date: Mon, 21 Jan 2013 14:59:34 +0100 Subject: [PATCH 104/164] Syntax change in FMRILinearModel.contrast implementation --- nipy/modalities/fmri/glm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/modalities/fmri/glm.py b/nipy/modalities/fmri/glm.py index 1794a9766e..dd09739ac4 100644 --- a/nipy/modalities/fmri/glm.py +++ b/nipy/modalities/fmri/glm.py @@ -567,7 +567,7 @@ def contrast(self, contrasts, con_id='', contrast_type=None, output_z=True, for i, (glm, con) in enumerate(zip(self.glms, contrasts)): if np.all(con == 0): warn('Contrast for session %d is null' % i) - elif not contrast_: + elif contrast_ is None: contrast_ = glm.contrast(con, contrast_type) else: contrast_ = contrast_ + glm.contrast(con, contrast_type) From 342ac0b27c7c611c8c9f57c47ded220e3b915644 Mon Sep 17 00:00:00 2001 From: Yannick Schwartz Date: Mon, 21 Jan 2013 16:53:46 +0100 Subject: [PATCH 105/164] Added test in test_glm.test_high_level_glm_null_contrasts and fixed a glitch in test_glm.generate_fake_fmri_data --- nipy/modalities/fmri/tests/test_glm.py | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/nipy/modalities/fmri/tests/test_glm.py b/nipy/modalities/fmri/tests/test_glm.py index d8b4c2fda2..91502ae136 100644 --- a/nipy/modalities/fmri/tests/test_glm.py +++ b/nipy/modalities/fmri/tests/test_glm.py @@ -34,15 +34,16 @@ def write_fake_fmri_data(shapes, rk=3, affine=np.eye(4)): def generate_fake_fmri_data(shapes, rk=3, affine=np.eye(4)): - fmri_data, design_matrices= [] + fmri_data = [] + design_matrices = [] for i, shape in enumerate(shapes): data = 100 + np.random.randn(*shape) data[0] -= 10 fmri_data.append(Nifti1Image(data, affine)) design_matrices.append(np.random.randn(shape[3], rk)) - mask = Nifti1Image((np.random.rand(*shape[:3]) > .5).astype(np.int8), + mask = Nifti1Image((np.random.rand(*shape[:3]) > .5).astype(np.int8), affine) - return mask, fmri_data, design_matrices + return mask, fmri_data, design_matrices def test_high_level_glm_with_paths(): @@ -105,6 +106,22 @@ def test_high_level_glm_contrasts(): z1.get_data(), z2.get_data())).all()) +def test_high_level_glm_null_contrasts(): + shapes, rk = ((5, 6, 7, 20), (5, 6, 7, 19)), 3 + mask, fmri_data, design_matrices = generate_fake_fmri_data(shapes, rk) + + multi_session_model = FMRILinearModel( + fmri_data, design_matrices, mask=None) + multi_session_model.fit() + single_session_model = FMRILinearModel( + fmri_data[:1], design_matrices[:1], mask=None) + single_session_model.fit() + z1, = multi_session_model.contrast([np.eye(rk)[:1]] * 2) + z2, = multi_session_model.contrast([np.eye(rk)[:1], np.zeros((1, rk))]) + z3, = single_session_model.contrast([np.eye(rk)[:1]]) + np.testing.assert_almost_equal(z2.get_data(), z3.get_data()) + + def ols_glm(n=100, p=80, q=10): X, Y = np.random.randn(p, q), np.random.randn(p, n) glm = GeneralLinearModel(X) From eb58b46b2c49374f9be598969d89b29ebc6c5ad9 Mon Sep 17 00:00:00 2001 From: Yannick Schwartz Date: Tue, 22 Jan 2013 10:29:38 +0100 Subject: [PATCH 106/164] Removed useless contrast in test_glm.test_high_level_glm_null_contrasts --- nipy/modalities/fmri/tests/test_glm.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/nipy/modalities/fmri/tests/test_glm.py b/nipy/modalities/fmri/tests/test_glm.py index 91502ae136..b4862a2f1d 100644 --- a/nipy/modalities/fmri/tests/test_glm.py +++ b/nipy/modalities/fmri/tests/test_glm.py @@ -116,10 +116,9 @@ def test_high_level_glm_null_contrasts(): single_session_model = FMRILinearModel( fmri_data[:1], design_matrices[:1], mask=None) single_session_model.fit() - z1, = multi_session_model.contrast([np.eye(rk)[:1]] * 2) - z2, = multi_session_model.contrast([np.eye(rk)[:1], np.zeros((1, rk))]) - z3, = single_session_model.contrast([np.eye(rk)[:1]]) - np.testing.assert_almost_equal(z2.get_data(), z3.get_data()) + z1, = multi_session_model.contrast([np.eye(rk)[:1], np.zeros((1, rk))]) + z2, = single_session_model.contrast([np.eye(rk)[:1]]) + np.testing.assert_almost_equal(z1.get_data(), z2.get_data()) def ols_glm(n=100, p=80, q=10): From e0e71a8bb9ae6b88e1ed7b40fb4b5f4fd65875e8 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 23 Jan 2013 16:48:10 -0800 Subject: [PATCH 107/164] DOC: working out windows compiles Not yet compiling on windows 64-bit, working notes for trying to do this. --- doc/devel/guidelines/compiling_windows.rst | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 doc/devel/guidelines/compiling_windows.rst diff --git a/doc/devel/guidelines/compiling_windows.rst b/doc/devel/guidelines/compiling_windows.rst new file mode 100644 index 0000000000..e0caaadc9b --- /dev/null +++ b/doc/devel/guidelines/compiling_windows.rst @@ -0,0 +1,21 @@ +Some notes on compiling on windows with Visual Studio +----------------------------------------------------- + +I followed instructions here: + +http://wiki.cython.org/64BitCythonExtensionsOnWindows + +First I downloaded and installed from here: + +http://download.microsoft.com/download/2/E/9/2E911956-F90F-4BFB-8231-E292A7B6F287/GRMSDKX_EN_DVD.iso + +via here: http://www.microsoft.com/en-us/download/details.aspx?id=18950#instructions + +Then I got Visual Studio 2008 from here: + +http://www.microsoft.com/en-us/download/details.aspx?id=14597 + +(file ``vcsetup.exe``) with hints from here: + +http://docs.python.org/devguide/setup.html#windows +http://bugs.python.org/issue16161 From 50583f161d236c872e21433cba9fe1d4977a2925 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 23 Jan 2013 18:42:03 -0800 Subject: [PATCH 108/164] NF: tool to refresh modification time of C files Build step checks modification times of C files relative to their source Pyx files. git checkout on windows sometimes generates C files that are detectably earlier in modification time than the pyx files, so the build step tries to rebuild them using Cython. This utility touches the C files to set the modification time later than the pyx files. --- tools/touch_cython_cs.py | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 tools/touch_cython_cs.py diff --git a/tools/touch_cython_cs.py b/tools/touch_cython_cs.py new file mode 100755 index 0000000000..90e449ef64 --- /dev/null +++ b/tools/touch_cython_cs.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python +""" Refresh modification times on Cython generated C files + +This is sometimes necessary on windows when the git checkout appears to +sometimes checkout the C files with modification times earlier than the pyx +files, triggering an attempt to rebuild the C files with Cython when running a +build. +""" +from __future__ import with_statement +import os +from os.path import splitext, join as pjoin, isfile +import sys +import optparse + + +# From http://stackoverflow.com/questions/1158076/implement-touch-using-python +if sys.version_info[0] >= 3: + def touch(fname, times=None, ns=None, dir_fd=None): + with os.open(fname, os.O_APPEND, dir_fd=dir_fd) as f: + os.utime(f.fileno() if os.utime in os.supports_fd else fname, + times=times, ns=ns, dir_fd=dir_fd) +else: + def touch(fname, times=None): + with file(fname, 'a'): + os.utime(fname, times) + + +def main(): + parser = optparse.OptionParser(usage='%prog []') + (opts, args) = parser.parse_args() + if len(args) > 1: + parser.print_help() + sys.exit(-1) + elif len(args) == 1: + root_dir = args[0] + else: + root_dir = os.getcwd() + for dirpath, dirnames, filenames in os.walk(root_dir): + for fn in filenames: + if fn.endswith('.pyx'): + froot, ext = splitext(fn) + cfile = pjoin(dirpath, froot + '.c') + if isfile(cfile): + touch(cfile) + + +if __name__ == '__main__': + main() From 8df7f4dbf535bdc97d72ba73ea9434a402d2bb73 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 23 Jan 2013 22:01:10 -0800 Subject: [PATCH 109/164] RF: replace numpy.testing.assert_ with assert_true numpy.testing.assert_ appeared in numpy 1.3. That's pretty old, but it's the only thing stopping us being compatible with numpy 1.2, and nose assert_true is just as readable. --- nipy/labs/datasets/transforms/tests/test_affine_transform.py | 4 ++-- nipy/labs/datasets/transforms/tests/test_transform.py | 4 ++-- nipy/labs/datasets/volumes/tests/test_volume_img.py | 4 +++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nipy/labs/datasets/transforms/tests/test_affine_transform.py b/nipy/labs/datasets/transforms/tests/test_affine_transform.py index e3721203d6..88ab501722 100644 --- a/nipy/labs/datasets/transforms/tests/test_affine_transform.py +++ b/nipy/labs/datasets/transforms/tests/test_affine_transform.py @@ -8,7 +8,7 @@ import copy # Don't import from nipy.testing not to have a hard dependence on nipy, # use np.testing or nose -from nose.tools import assert_equal +from nose.tools import assert_equal, assert_true from ..affine_transform import AffineTransform @@ -41,7 +41,7 @@ def test_misc(): transform = AffineTransform('in', 'out', np.random.random((3, 3))) # Check that the repr does not raise an error: - yield np.testing.assert_, isinstance(repr(transform), str) + yield assert_true, isinstance(repr(transform), str) # Check that copy and eq work yield assert_equal, transform, copy.copy(transform) yield assert_equal, transform, copy.deepcopy(transform) diff --git a/nipy/labs/datasets/transforms/tests/test_transform.py b/nipy/labs/datasets/transforms/tests/test_transform.py index 65f4d67678..83ea0eb74d 100644 --- a/nipy/labs/datasets/transforms/tests/test_transform.py +++ b/nipy/labs/datasets/transforms/tests/test_transform.py @@ -9,7 +9,7 @@ import copy # Don't import from nipy.testing not to have a hard dependence on nipy, # use np.testing or nose -from nose.tools import assert_equal, assert_raises +from nose.tools import assert_equal, assert_raises, assert_true from ..transform import Transform, CompositionError @@ -56,7 +56,7 @@ def test_misc(): transform = Transform('in', 'out', mapping=mapping) # Check that the repr does not raise an error: - yield np.testing.assert_, isinstance(repr(transform), str) + yield assert_true, isinstance(repr(transform), str) # Check that copy and eq work yield assert_equal, transform, copy.copy(transform) diff --git a/nipy/labs/datasets/volumes/tests/test_volume_img.py b/nipy/labs/datasets/volumes/tests/test_volume_img.py index bb6e1ff958..cd89cf5b91 100644 --- a/nipy/labs/datasets/volumes/tests/test_volume_img.py +++ b/nipy/labs/datasets/volumes/tests/test_volume_img.py @@ -14,6 +14,8 @@ from ...transforms.transform import Transform from ..volume_img import VolumeImg, CompositionError +from nose.tools import assert_true + ################################################################################ # Helper function def rotation(theta, phi): @@ -170,7 +172,7 @@ def test_eq(): copy_im.world_space = 'other' yield nose.tools.assert_not_equal, ref_im, copy_im # Test repr - yield np.testing.assert_, isinstance(repr(ref_im), str) + yield assert_true, isinstance(repr(ref_im), str) # Test init: should raise exception is not passing in right affine yield nose.tools.assert_raises, Exception, VolumeImg, data, \ np.eye(3, 3), 'mine' From 3316c314ca783392de8c749dd08da37eccaba59f Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 23 Jan 2013 22:10:53 -0800 Subject: [PATCH 110/164] RF: no dict methods for old numpy load returns Older numpies (at least up until 1.3) return a dict-like thing from ``np.load`` on an ``npz`` file, but without an ``items`` method or other helpful iteration stuff. Fall back to the ``files`` attribute on the returned object to find the first and only array to get the design matrix. --- nipy/modalities/fmri/glm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nipy/modalities/fmri/glm.py b/nipy/modalities/fmri/glm.py index dd09739ac4..4a96579abd 100644 --- a/nipy/modalities/fmri/glm.py +++ b/nipy/modalities/fmri/glm.py @@ -475,8 +475,8 @@ def __init__(self, fmri_data, design_matrices, mask='compute', # load the designs for design_matrix in design_matrices: if isinstance(design_matrix, basestring): - self.design_matrices.append( - np.load(design_matrix).items()[0][1]) + loaded = np.load(design_matrix) + self.design_matrices.append(loaded[loaded.files[0]]) else: self.design_matrices.append(design_matrix) From eaa422a0d3bddb1c942a00699e8ca3957daaaaa4 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 23 Jan 2013 22:35:47 -0800 Subject: [PATCH 111/164] RF: avoid import error for numpy 1.2 measure function not present in numpy 1.2; avoid import error during tests by deferring name lookup until benchmarks are run. They will still error in numpy 1.2 when benchmarking, but having the benchmarks run is more of a luxury than having the tests run without error. --- .../statistics/bench/bench_intvol.py | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/nipy/algorithms/statistics/bench/bench_intvol.py b/nipy/algorithms/statistics/bench/bench_intvol.py index f1d081e33c..6a033e216a 100644 --- a/nipy/algorithms/statistics/bench/bench_intvol.py +++ b/nipy/algorithms/statistics/bench/bench_intvol.py @@ -5,8 +5,8 @@ from .. import intvol from ..tests.test_intrinsic_volumes import nonintersecting_boxes, randorth -from numpy.testing import measure +import numpy.testing as npt def bench_lips3d(): np.random.seed(20111001) @@ -19,16 +19,16 @@ def bench_lips3d(): sys.stdout.flush() print "\nIntrinsic volumes 3D" print "--------------------" - print 'Box1 %6.2f\n' % measure('phi(c,box1)', repeat), - print 'Box2 %6.2f\n' % measure('phi(c, box2)', repeat), - print 'Box1+2 %6.2f\n' % measure('phi(c, box1 + box2)', repeat), + print 'Box1 %6.2f\n' % npt.measure('phi(c,box1)', repeat), + print 'Box2 %6.2f\n' % npt.measure('phi(c, box2)', repeat), + print 'Box1+2 %6.2f\n' % npt.measure('phi(c, box1 + box2)', repeat), d = np.random.standard_normal((10,) + (bx_sz,) * 3) - print 'Box1+2 d %6.2f\n' % measure('phi(d, box1 + box2)', repeat), + print 'Box1+2 d %6.2f\n' % npt.measure('phi(d, box1 + box2)', repeat), U = randorth(p=6)[0:3] e = np.dot(U.T, c.reshape((c.shape[0], -1))) e.shape = (e.shape[0],) + c.shape[1:] - print 'Box1+2 e %6.2f\n' % measure('phi(e, box1 + box2)', repeat), - print 'Box1+2 EC %6.2f\n' % measure('EC3d(box1 + box2)', repeat), + print 'Box1+2 e %6.2f\n' % npt.measure('phi(e, box1 + box2)', repeat), + print 'Box1+2 EC %6.2f\n' % npt.measure('EC3d(box1 + box2)', repeat), sys.stdout.flush() @@ -43,16 +43,16 @@ def bench_lips2d(): sys.stdout.flush() print "\nIntrinsic volumes 2D" print "--------------------" - print 'Box1 %6.2f\n' % measure('phi(c,box1)', repeat), - print 'Box2 %6.2f\n' % measure('phi(c, box2)', repeat), - print 'Box1+2 %6.2f\n' % measure('phi(c, box1 + box2)', repeat), + print 'Box1 %6.2f\n' % npt.measure('phi(c,box1)', repeat), + print 'Box2 %6.2f\n' % npt.measure('phi(c, box2)', repeat), + print 'Box1+2 %6.2f\n' % npt.measure('phi(c, box1 + box2)', repeat), d = np.random.standard_normal((10,) + (bx_sz,) * 2) - print 'Box1+2 d %6.2f\n' % measure('phi(d, box1 + box2)', repeat), + print 'Box1+2 d %6.2f\n' % npt.measure('phi(d, box1 + box2)', repeat), U = randorth(p=6)[0:2] e = np.dot(U.T, c.reshape((c.shape[0], -1))) e.shape = (e.shape[0],) + c.shape[1:] - print 'Box1+2 e %6.2f\n' % measure('phi(e, box1 + box2)', repeat), - print 'Box1+2 EC %6.2f\n' % measure('EC2d(box1 + box2)', repeat), + print 'Box1+2 e %6.2f\n' % npt.measure('phi(e, box1 + box2)', repeat), + print 'Box1+2 EC %6.2f\n' % npt.measure('EC2d(box1 + box2)', repeat), sys.stdout.flush() @@ -67,14 +67,14 @@ def bench_lips1d(): sys.stdout.flush() print "\nIntrinsic volumes 1D" print "--------------------" - print 'Box1 %6.2f\n' % measure('phi(c,box1)', repeat), - print 'Box2 %6.2f\n' % measure('phi(c, box2)', repeat), - print 'Box1+2 %6.2f\n' % measure('phi(c, box1 + box2)', repeat), + print 'Box1 %6.2f\n' % npt.measure('phi(c,box1)', repeat), + print 'Box2 %6.2f\n' % npt.measure('phi(c, box2)', repeat), + print 'Box1+2 %6.2f\n' % npt.measure('phi(c, box1 + box2)', repeat), d = np.random.standard_normal((10, bx_sz)) - print 'Box1+2 d %6.2f\n' % measure('phi(d, box1 + box2)', repeat), + print 'Box1+2 d %6.2f\n' % npt.measure('phi(d, box1 + box2)', repeat), U = randorth(p=6)[0:1] e = np.dot(U.T, c.reshape((c.shape[0], -1))) e.shape = (e.shape[0],) + c.shape[1:] - print 'Box1+2 e %6.2f\n' % measure('phi(e, box1 + box2)', repeat), - print 'Box1+2 EC %6.2f\n' % measure('EC1d(box1 + box2)', repeat), + print 'Box1+2 e %6.2f\n' % npt.measure('phi(e, box1 + box2)', repeat), + print 'Box1+2 EC %6.2f\n' % npt.measure('EC1d(box1 + box2)', repeat), sys.stdout.flush() From e493a752ce7472cf6b4c7dc08e75db801a7d4dc3 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 25 Jan 2013 23:29:17 -0800 Subject: [PATCH 112/164] RF: add py3 wrapper around csv file opening In Python 2, csv file objects need to be binary ('rb' or 'wb' mode). In Python 3, they need to be text, but with ``newline = ''` (see http://docs.python.org/3/library/csv.html#csv.reader). --- nipy/utils/compat3.py | 26 +++++++++++++++++++++++++- nipy/utils/tests/test_compat3.py | 25 ++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/nipy/utils/compat3.py b/nipy/utils/compat3.py index 15c2713822..ff34d47518 100644 --- a/nipy/utils/compat3.py +++ b/nipy/utils/compat3.py @@ -4,8 +4,9 @@ """ import sys +py3 = sys.version_info[0] >= 3 -if sys.version_info[0] >= 3: +if py3: def to_str(s): """ Convert `s` to string, decoding as latin1 if `s` is bytes """ @@ -14,3 +15,26 @@ def to_str(s): return str(s) else: to_str = str + + +def open4csv(fname, mode): + """ Open filename `fname` for CSV IO in read or write `mode` + + Parameters + ---------- + fname : str + filename to open + mode : {'r', 'w'} + Mode to open file. Don't specify binary or text modes; we need to + chose these according to python version. + + Returns + ------- + fobj : file object + open file object; needs to be closed by the caller + """ + if mode not in ('r', 'w'): + raise ValueError('Only "r" and "w" allowed for mode') + if not py3: # Files for csv reading and writing should be binary mode + return open(fname, mode + 'b') + return open(fname, mode, newline='') diff --git a/nipy/utils/tests/test_compat3.py b/nipy/utils/tests/test_compat3.py index 68fba272c4..6e634318e7 100644 --- a/nipy/utils/tests/test_compat3.py +++ b/nipy/utils/tests/test_compat3.py @@ -1,13 +1,16 @@ """ Testing compat3 module """ +from __future__ import with_statement from nibabel.py3k import asstr, asbytes -from ..compat3 import to_str +from ..compat3 import to_str, open4csv from nose.tools import (assert_true, assert_false, assert_raises, assert_equal, assert_not_equal) +from nibabel.tmpdirs import InTemporaryDirectory + def test_to_str(): # Test routine to convert to string @@ -15,3 +18,23 @@ def test_to_str(): assert_equal('1.0', to_str(1.0)) assert_equal('from', to_str(asstr('from'))) assert_equal('from', to_str(asbytes('from'))) + + +def test_open4csv(): + # Test opening of csv files + import csv + contents = [['oh', 'my', 'G'], + ['L', 'O', 'L'], + ['when', 'cleaning', 'windas']] + with InTemporaryDirectory(): + with open4csv('my.csv', 'w') as fobj: + writer = csv.writer(fobj) + writer.writerows(contents) + with open4csv('my.csv', 'r') as fobj: + dialect = csv.Sniffer().sniff(fobj.read()) + fobj.seek(0) + reader = csv.reader(fobj, dialect) + back = list(reader) + assert_equal(contents, back) + assert_raises(ValueError, open4csv, 'my.csv', 'rb') + assert_raises(ValueError, open4csv, 'my.csv', 'wt') From 83a80824177709ce1d1aa52502590ac3277cc119 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 25 Jan 2013 23:40:32 -0800 Subject: [PATCH 113/164] BF: use open4csv compatibility function Opening files for CSV read/write differs between python 2 and python 3. Use compatibility wrapper. --- nipy/modalities/fmri/design_matrix.py | 40 +++++----- nipy/modalities/fmri/experimental_paradigm.py | 80 +++++++++---------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/nipy/modalities/fmri/design_matrix.py b/nipy/modalities/fmri/design_matrix.py index 3708fb0bb7..4e0ed5bcff 100644 --- a/nipy/modalities/fmri/design_matrix.py +++ b/nipy/modalities/fmri/design_matrix.py @@ -1,5 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import with_statement """ This module implements fMRI Design Matrix creation. @@ -26,7 +27,9 @@ from warnings import warn -from hemodynamic_models import compute_regressor, _orthogonalize +from ...utils.compat3 import open4csv + +from .hemodynamic_models import compute_regressor, _orthogonalize ###################################################################### @@ -262,11 +265,10 @@ def write_csv(self, path): The frametimes are not written """ import csv - fid = open(path, "wt") - writer = csv.writer(fid) - writer.writerow(self.names) - writer.writerows(self.matrix) - fid.close() + with open4csv(path, "w") as fid: + writer = csv.writer(fid) + writer.writerow(self.names) + writer.writerows(self.matrix) def show(self, rescale=True, ax=None): """Visualization of a design matrix @@ -398,21 +400,19 @@ def dmtx_from_csv(path, frametimes=None): A DesignMatrix instance """ import csv - csvfile = open(path, 'rt') - dialect = csv.Sniffer().sniff(csvfile.read()) - csvfile.seek(0) - reader = csv.reader(csvfile, dialect) - boolfirst = True - design = [] - for row in reader: - if boolfirst: - names = [row[j] for j in range(len(row))] - boolfirst = False - else: - design.append([row[j] for j in range(len(row))]) - + with open4csv(path, 'r') as csvfile: + dialect = csv.Sniffer().sniff(csvfile.read()) + csvfile.seek(0) + reader = csv.reader(csvfile, dialect) + boolfirst = True + design = [] + for row in reader: + if boolfirst: + names = [row[j] for j in range(len(row))] + boolfirst = False + else: + design.append([row[j] for j in range(len(row))]) x = np.array([[float(t) for t in xr] for xr in design]) - csvfile.close() return(DesignMatrix(x, names, frametimes)) diff --git a/nipy/modalities/fmri/experimental_paradigm.py b/nipy/modalities/fmri/experimental_paradigm.py index f8c31a9de5..2dec42b9cd 100644 --- a/nipy/modalities/fmri/experimental_paradigm.py +++ b/nipy/modalities/fmri/experimental_paradigm.py @@ -20,6 +20,8 @@ import numpy as np +from ...utils.compat3 import open4csv + ########################################################## # Paradigm handling ########################################################## @@ -75,28 +77,27 @@ def write_to_csv(self, csv_file, session='0'): session: string, optional, session identifier """ import csv - fid = open(csv_file, "wt") - writer = csv.writer(fid, delimiter=' ') - n_pres = np.size(self.con_id) - sess = np.repeat(session, n_pres) - pdata = np.vstack((sess, self.con_id, self.onset)).T - - # add the duration information - if self.type == 'event': - duration = np.zeros(np.size(self.con_id)) - else: - duration = self.duration - pdata = np.hstack((pdata, np.reshape(duration, (n_pres, 1)))) + with open4csv(csv_file, "w") as fid: + writer = csv.writer(fid, delimiter=' ') + n_pres = np.size(self.con_id) + sess = np.repeat(session, n_pres) + pdata = np.vstack((sess, self.con_id, self.onset)).T + + # add the duration information + if self.type == 'event': + duration = np.zeros(np.size(self.con_id)) + else: + duration = self.duration + pdata = np.hstack((pdata, np.reshape(duration, (n_pres, 1)))) - # add the amplitude information - if self.amplitude is not None: - amplitude = np.reshape(self.amplitude, (n_pres, 1)) - pdata = np.hstack((pdata, amplitude)) + # add the amplitude information + if self.amplitude is not None: + amplitude = np.reshape(self.amplitude, (n_pres, 1)) + pdata = np.hstack((pdata, amplitude)) - # write pdata - for row in pdata: - writer.writerow(row) - fid.close() + # write pdata + for row in pdata: + writer.writerow(row) class EventRelatedParadigm(Paradigm): @@ -172,25 +173,25 @@ def load_paradigm_from_csv_file(path, session=None): would be much clearer if amplitude was put before duration in the .csv """ import csv - csvfile = open(path, 'rt') - dialect = csv.Sniffer().sniff(csvfile.read()) - csvfile.seek(0) - reader = csv.reader(csvfile, dialect) - - # load the csv as a paradigm array - sess, cid, onset, amplitude, duration = [], [], [], [], [] - for row in reader: - sess.append(row[0]) - cid.append(row[1]) - onset.append(float(row[2])) - if len(row) > 3: - duration.append(float(row[3])) - if len(row) > 4: - amplitude.append(row[4]) - - paradigm_info = [np.array(sess), np.array(cid), np.array(onset), - np.array(duration), np.array(amplitude)] - paradigm_info = paradigm_info[:len(row)] + with open4csv(path, 'r') as csvfile: + dialect = csv.Sniffer().sniff(csvfile.read()) + csvfile.seek(0) + reader = csv.reader(csvfile, dialect) + + # load the csv as a paradigm array + sess, cid, onset, amplitude, duration = [], [], [], [], [] + for row in reader: + sess.append(row[0]) + cid.append(row[1]) + onset.append(float(row[2])) + if len(row) > 3: + duration.append(float(row[3])) + if len(row) > 4: + amplitude.append(row[4]) + + paradigm_info = [np.array(sess), np.array(cid), np.array(onset), + np.array(duration), np.array(amplitude)] + paradigm_info = paradigm_info[:len(row)] def read_session(paradigm_info, session): """ return a paradigm instance corresponding to session @@ -220,5 +221,4 @@ def read_session(paradigm_info, session): paradigm[session] = read_session(paradigm_info, session) else: paradigm = read_session(paradigm_info, session) - csvfile.close() return paradigm From 9a4a038d1805fe72aa77b86ce1ed58fc09fea0cb Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 25 Jan 2013 23:48:18 -0800 Subject: [PATCH 114/164] BF: manual fix for csv writing in example Use manual fix for Python 2 / 3 differences for clarity in example. --- examples/labs/write_paradigm_file.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/labs/write_paradigm_file.py b/examples/labs/write_paradigm_file.py index d4608ed2cb..3c19b044d8 100755 --- a/examples/labs/write_paradigm_file.py +++ b/examples/labs/write_paradigm_file.py @@ -7,6 +7,7 @@ See Pinel et al., BMC neuroscience 2007 for reference """ +import sys import csv import numpy as np @@ -45,7 +46,11 @@ sess = np.zeros(np.size(time)).astype('int8') pdata = np.vstack((sess, cid, time)).T csvfile = 'localizer_paradigm.csv' -fid = open(csvfile, "wt") +# Opening files for CSV writing differs between Python 2 and 3 +if sys.version_info[0] >= 3: # Python 3 + fid = open(csvfile, "w", newline = '') +else: # Python 2 + fid = open(csvfile, "wb") writer = csv.writer(fid, delimiter=' ') for row in pdata: writer.writerow(row) From 80c283bbe7e0acfdd275d83e24da42851f0ed593 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 31 Jan 2013 11:48:05 -0800 Subject: [PATCH 115/164] BF: make windows script wrappers more robust The script wrappers were hard-coding the python path at the time of the creation of the binary such as an exe or an egg. This path is likely to be wrong after the binary is installed somewhere. Use some minor bat file programming to pull the Python command out of the script directly, rather like the ``cli.exe`` trick used by setuptools. --- setup_helpers.py | 83 ++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/setup_helpers.py b/setup_helpers.py index 4fd5a40aaf..7b9afe26ff 100755 --- a/setup_helpers.py +++ b/setup_helpers.py @@ -16,11 +16,10 @@ # Standard library imports import sys import os -from os.path import join as pjoin, dirname, isfile +from os.path import join as pjoin, dirname, splitext, split as psplit import zipfile import warnings import shutil -import re from distutils.cmd import Command from distutils.command.clean import clean from distutils.command.install_scripts import install_scripts @@ -299,69 +298,69 @@ def generate_a_pyrex_source(self, base, ext_name, source, extension): (CYTHON_MIN_VERSION, source)) return target_file -EXE_MATCH_RE = re.compile('^#!.*python[0-9.]*', re.IGNORECASE) +BAT_TEMPLATE = \ +r"""@echo off +set mypath=%~dp0 +set pyscript="%mypath%{FNAME}" +set /p line1=<%pyscript% +if "%line1:~0,2%" == "#!" (goto :goodstart) +echo First line of %pyscript% does not start with "#!" +exit /b 1 +:goodstart +set py_exe=%line1:~2% +call %py_exe% %pyscript% %* +""" class install_scripts_nipy(install_scripts): """ Make scripts executable on Windows Scripts are bare file names without extension on Unix, fitting (for example) Debian rules. They identify as python scripts with the usual ``#!`` first - line. This doesn't work on Windows. So, on Windows only we: - - * Add a ``.py`` extension to the ``bare_script_name`` to select interpeter - by extension - * Add a ``.bat`` wrapper of name ``bare_script_name.bat`` to call - ``bare_script_name.py`` using the python interpreter. + line. This doesn't work on Windows. So, on Windows only we ad a ``.bat`` + wrapper of name ``bare_script_name.bat`` to call ``bare_script_name`` + using the python interpreter from the #! first line of the script. Notes ----- The idea for this routine came from an idea in Twisted, re-used in IPython An alternative to this method would be to use the ``distribute`` / - ``setuptools`` ``cli.exe`` method, where we copy a pre-compiled Windows - executable ``cli.exe`` as ``bare_script_name.exe``, and the script as - ``bare_script_name-script.py``. The executable file ``cli.exe`` (copied as - ``bare_script_name.exe``) analyzes its own name, and then calls - ``bare_script_name-script.py`` with the Python interpreter named in the top - line of the script file. But, ``.bat`` wrappers as here seem to work on all - current versions of Windows, are simpler to understand, and don't require - putting pre-compiled code into the repository. + ``setuptools`` ``cli.exe`` method. We could do this by defining console + entry points for the scripts, and moving the script code into the libary. + setuptools then copies a pre-compiled Windows executable ``cli.exe`` as + ``bare_script_name.exe``, and the script as ``bare_script_name-script.py``. + The executable file ``cli.exe`` (copied as ``bare_script_name.exe``) + analyzes its own name, and then calls ``bare_script_name-script.py`` with + the Python interpreter named in the top line of the script file. Doing this + induces a run-time dependency on setuptools because the generated python + script files import ``pkg_resources``. + + See git://github.com/matthew-brett/myscripter.git for some experiments to + show what setuptools and distutils are doing. """ def run(self): install_scripts.run(self) if not os.name == "nt": return - for file in self.get_outputs(): - # rename script to .py so it can be executed on windows - if file.endswith(".py"): - # Only do this processing on the bare scripts, not .py scripts. - continue - log.info("Adding .py extension to %s", file) - py_file = file + '.py' - if self.dry_run: - continue - if isfile(py_file): - os.unlink(py_file) - os.rename(file, py_file) + for filepath in self.get_outputs(): # If we can find an executable name in the #! top line of the script - # file, make .bat wrapper for .py script, using this executable - # name. The original name has been replaced by one specific to the - # platform during the build_script distutils step. - with open(py_file, 'rt') as fobj: + # file, make .bat wrapper for script. + with open(filepath, 'rt') as fobj: first_line = fobj.readline() - exe_match = EXE_MATCH_RE.match(first_line) - if exe_match is None: + if not (first_line.startswith('#!') and + 'python' in first_line.lower()): log.info("No #!python executable found, skipping .bat " "wrapper") continue - exe_stuff = first_line[2:].strip() - log.info("Making .bat wrapper for %s with executable %s", - py_file, exe_stuff) - bat_file = file + '.bat' - if isfile(bat_file): - os.unlink(bat_file) + pth, fname = psplit(filepath) + froot, ext = splitext(fname) + bat_file = pjoin(pth, froot + '.bat') + bat_contents = BAT_TEMPLATE.replace('{FNAME}', fname) + log.info("Making %s wrapper for %s" % (bat_file, filepath)) + if self.dry_run: + continue with open(bat_file, 'wt') as fobj: - fobj.write('@"%s" "%s"' % (exe_stuff, py_file) + " %*\n") + fobj.write(bat_contents) # The command classes for distutils, used by setup.py From 2655c5a4a8130232915f226a0eef6ad5e8042f8e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 31 Jan 2013 11:50:38 -0800 Subject: [PATCH 116/164] RF: don't use setuptools to create the .exe binary We don't need setuptools for bdist_wininst --- setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 57204cd825..586ea3255a 100755 --- a/setup.py +++ b/setup.py @@ -50,8 +50,7 @@ def configuration(parent_package='',top_path=None): # For some commands, use setuptools if len(set(('develop', 'bdist_egg', 'bdist_rpm', 'bdist', 'bdist_dumb', - 'bdist_wininst', 'install_egg_info', 'egg_info', 'easy_install', - 'bdist_mpkg', + 'install_egg_info', 'egg_info', 'easy_install', 'bdist_mpkg', )).intersection(sys.argv)) > 0: from setup_egg import extra_setuptools_args From 9c3bff716af85be86c8cce249ea37eb558d96008 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 31 Jan 2013 11:52:09 -0800 Subject: [PATCH 117/164] BF: use shell=True for windows script tests The default shell=False for windows meant that we weren't picking up surrounding changes to the PATH, and so not finding scripts installed into a virtualenv. --- nipy/tests/test_scripts.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index d70fa1f611..b6f2bc7667 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -31,7 +31,8 @@ needs_mpl = decorators.skipif(not HAVE_MPL, "Test needs matplotlib") script_test = make_label_dec('script_test') -USE_SHELL = os.name != 'nt' +# Need shell to get path to correct executables +USE_SHELL = True DEBUG_PRINT = os.environ.get('NIPY_DEBUG_PRINT', False) From b84ea0324a5a1eb3982633e6e0dda286bbaea6ed Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 12:06:01 -0800 Subject: [PATCH 118/164] DOC: comment in windows bat, rewrite docstring Comment to help reader of windows bat wrapper. Point readers to discussion of installation and bat files. --- setup_helpers.py | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/setup_helpers.py b/setup_helpers.py index 7b9afe26ff..2614022818 100755 --- a/setup_helpers.py +++ b/setup_helpers.py @@ -300,6 +300,7 @@ def generate_a_pyrex_source(self, base, ext_name, source, extension): BAT_TEMPLATE = \ r"""@echo off +REM wrapper to use shebang first line of {FNAME} set mypath=%~dp0 set pyscript="%mypath%{FNAME}" set /p line1=<%pyscript% @@ -316,27 +317,17 @@ class install_scripts_nipy(install_scripts): Scripts are bare file names without extension on Unix, fitting (for example) Debian rules. They identify as python scripts with the usual ``#!`` first - line. This doesn't work on Windows. So, on Windows only we ad a ``.bat`` - wrapper of name ``bare_script_name.bat`` to call ``bare_script_name`` - using the python interpreter from the #! first line of the script. + line. Unix recognizes and uses this first "shebang" line, but Windows does + not. So, on Windows only we add a ``.bat`` wrapper of name + ``bare_script_name.bat`` to call ``bare_script_name`` using the python + interpreter from the #! first line of the script. Notes ----- - The idea for this routine came from an idea in Twisted, re-used in IPython - - An alternative to this method would be to use the ``distribute`` / - ``setuptools`` ``cli.exe`` method. We could do this by defining console - entry points for the scripts, and moving the script code into the libary. - setuptools then copies a pre-compiled Windows executable ``cli.exe`` as - ``bare_script_name.exe``, and the script as ``bare_script_name-script.py``. - The executable file ``cli.exe`` (copied as ``bare_script_name.exe``) - analyzes its own name, and then calls ``bare_script_name-script.py`` with - the Python interpreter named in the top line of the script file. Doing this - induces a run-time dependency on setuptools because the generated python - script files import ``pkg_resources``. - - See git://github.com/matthew-brett/myscripter.git for some experiments to - show what setuptools and distutils are doing. + See discussion at + http://matthew-brett.github.com/pydagogue/installing_scripts.html and + example at git://github.com/matthew-brett/myscripter.git for more + background. """ def run(self): install_scripts.run(self) From a29dc33a1ac65b1596f7b9cc921fa00dc9b32b74 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 12:54:21 -0800 Subject: [PATCH 119/164] BF: forgot future import for with statement Using with statement, but forgot python 2.5 compatibility --- nipy/modalities/fmri/experimental_paradigm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipy/modalities/fmri/experimental_paradigm.py b/nipy/modalities/fmri/experimental_paradigm.py index 2dec42b9cd..d3d494158f 100644 --- a/nipy/modalities/fmri/experimental_paradigm.py +++ b/nipy/modalities/fmri/experimental_paradigm.py @@ -1,5 +1,6 @@ # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- # vi: set ft=python sts=4 ts=4 sw=4 et: +from __future__ import with_statement """ This module implements an object to deal with experimental paradigms. In fMRI data analysis, there are two main types of experimental From 4f5033c8016e2f445e9f871c76606942c8dfcf21 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 17:07:01 -0800 Subject: [PATCH 120/164] DOC: 64 bits print 0 as 0L from vtk datasets Work round printing difference between 32 and 64 bits for VTK datasets. --- .../comparisons/vtk_datasets.rst | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/devel/code_discussions/comparisons/vtk_datasets.rst b/doc/devel/code_discussions/comparisons/vtk_datasets.rst index a55daa75f8..82c9789461 100644 --- a/doc/devel/code_discussions/comparisons/vtk_datasets.rst +++ b/doc/devel/code_discussions/comparisons/vtk_datasets.rst @@ -5,7 +5,7 @@ Here we describe the VTK dataset model, because of some parallels with our own idea of an image object. The document is from the VTK book - [VTK4]_ -See also: +See also: * http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/data.html#vtk-data-structures * http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/auto/example_datasets.html @@ -45,14 +45,13 @@ refers to, you can identify the element. >>> pts = vtk.vtkPoints() >>> id = pts.InsertNextPoint(0, 0, 0) ->>> id -0 +>>> id == 0 +True >>> id = pts.InsertNextPoint(0, 1, 0) ->>> id -1 ->>> pts.GetPoint(1) -(0.0, 1.0, 0.0) - +>>> id == 1 +True +>>> pts.GetPoint(1) == (0.0, 1.0, 0.0) +True A dataset has one or more points ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -91,8 +90,8 @@ True >>> triangle.GetCellType() == VTK_TRIANGLE True >>> pt_ids = triangle.GetPointIds() # these are default (zeros) at the moment ->>> [pt_ids.GetId(i) for i in range(pt_ids.GetNumberOfIds())] -[0, 0, 0] +>>> [pt_ids.GetId(i) for i in range(pt_ids.GetNumberOfIds())] == [0, 0, 0] +True Here we set the ids. The ids refer to the points above. The system does not know this yet, but it will because, later, we are going to From 21a0faee80cac5ed5f6f50ba40cb0c5900fdade3 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 17:02:55 -0800 Subject: [PATCH 121/164] DOC: don't test uninteresting doctest It was failing due to sympy printing, and it's not testing nipy code. --- doc/users/glm_spec.rst | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/users/glm_spec.rst b/doc/users/glm_spec.rst index 46f22b6ac3..1d6330d2a9 100644 --- a/doc/users/glm_spec.rst +++ b/doc/users/glm_spec.rst @@ -275,17 +275,13 @@ the same :math:`f` above), but the different experimental model :math:`E` yields .. testcode:: - from sympy import Symbol, Heaviside, Piecewise + from sympy import Symbol, Piecewise ta = [0,4,8,12,16]; tb = [2,6,10,14,18] - ba = Symbol('ba'); bb = Symbol('bb') + ba = Symbol('ba') + bb = Symbol('bb') fa = sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t >= _t+0.5))) for _t in ta])*ba fb = sum([Piecewise((0, (t<_t)), ((t-_t)/0.5, (t<_t+0.5)), (1, (t >= _t+0.5))) for _t in tb])*bb N = fa+fb - print(N) - -.. testoutput:: - - ba*(Piecewise((0, t < 0), (2.0*t, t < 0.5), (1, t >= 0.5)) + Piecewise((0, t < 4), (2.0*t - 8.0, t < 4.5), (1, t >= 4.5)) + Piecewise((0, t < 8), (2.0*t - 16.0, t < 8.5), (1, t >= 8.5)) + Piecewise((0, t < 12), (2.0*t - 24.0, t < 12.5), (1, t >= 12.5)) + Piecewise((0, t < 16), (2.0*t - 32.0, t < 16.5), (1, t >= 16.5))) + bb*(Piecewise((0, t < 2), (2.0*t - 4.0, t < 2.5), (1, t >= 2.5)) + Piecewise((0, t < 6), (2.0*t - 12.0, t < 6.5), (1, t >= 6.5)) + Piecewise((0, t < 10), (2.0*t - 20.0, t < 10.5), (1, t >= 10.5)) + Piecewise((0, t < 14), (2.0*t - 28.0, t < 14.5), (1, t >= 14.5)) + Piecewise((0, t < 18), (2.0*t - 36.0, t < 18.5), (1, t >= 18.5))) Or, graphically, if we set :math:`\beta_a=1` and :math:`\beta_b=-2`, as From f7b658109a46c0da0499745157966829f663f1cc Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 19:44:36 -0800 Subject: [PATCH 122/164] DOC: update AUTHOR and Changelog for release --- AUTHOR | 1 + Changelog | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/AUTHOR b/AUTHOR index b9d6fe5a89..dc81721a6f 100644 --- a/AUTHOR +++ b/AUTHOR @@ -14,4 +14,5 @@ Mike Trumpis Tim Leslie Tom Waite Virgile Fritsch +Yannick Schwartz Yaroslav Halchenko diff --git a/Changelog b/Changelog index 136b86edda..2ef77877c9 100644 --- a/Changelog +++ b/Changelog @@ -30,7 +30,7 @@ Abbreviated authors are: * GV - Gaël Varoquaux * YH - Yarik Halchenko -* 0.3.0 (Monday 14 January 2013) +* 0.3.0 (Saturday 2 February 2013) * Bugfix, refactoring and compatibility release * Addition of EM algorithm for mixed effects analysis (BT) @@ -53,7 +53,8 @@ Abbreviated authors are: * Script to run examples for testing (MB) * Fix for accidental integer division of frametimes in design matrix generation (Fabian Pedregosa) - * Various other fixes and refactorings with thanks from (AR, BT, MB, YR) + * Various other fixes and refactorings with thanks from (AR, BT, MB, YR, + Yannick Schwartz, Virgile Fritsch) * 0.2.0 (Sunday 22 July 2012) From aecf1f49180f346b9b473027f4d24e8f9d213f8f Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 19:54:11 -0800 Subject: [PATCH 123/164] DOC: update install instructions Get us more focussed on binary installation when possible. --- doc/links_names.txt | 16 +++- doc/users/installation.rst | 190 ++++++++++++++++++++++++++----------- 2 files changed, 149 insertions(+), 57 deletions(-) diff --git a/doc/links_names.txt b/doc/links_names.txt index fb026e35e2..6a0009c546 100644 --- a/doc/links_names.txt +++ b/doc/links_names.txt @@ -52,9 +52,6 @@ .. _Ubuntu: http://www.ubuntu.com .. _MacPorts: http://www.macports.org/ -.. Installation -.. _pypi: http://pypi.python.org/pypi - .. Working process .. _pynifti: http://niftilib.sourceforge.net/pynifti/ .. _nifticlibs: http://nifti.nimh.nih.gov @@ -63,6 +60,15 @@ .. _github: http://github.com .. _launchpad: https://launchpad.net/ +.. Python packaging +.. _distutils: http://docs.python.org/2/library/distutils.html +.. _setuptools: http://pypi.python.org/pypi/setuptools +.. _distribute: http://pypi.python.org/pypi/distribute +.. _pip: http://pypi.python.org/pypi/pip +.. _old and new python versions: https://launchpad.net/%7Efkrull/+archive/deadsnakes +.. _pypi: http://pypi.python.org +.. _example pypi: http://packages.python.org/an_example_pypi_project/setuptools.html#intermezzo-pypirc-file-and-gpg + .. Code support stuff .. _pychecker: http://pychecker.sourceforge.net/ .. _pylint: http://www.logilab.org/project/pylint @@ -96,7 +102,11 @@ .. _nibabel: http://nipy.org/nibabel .. _networkx: http://networkx.lanl.gov/ .. _pythonxy: http://www.pythonxy.com/ +.. _python (x, y): http://www.pythonxy.com/ .. _EPD: http://www.enthought.com/products/epd.php +.. _EPD free: http://www.enthought.com/products/epd_free.php +.. _Anaconda CE: https://store.continuum.io/ +.. _Unofficial Windows binaries: http://www.lfd.uci.edu/~gohlke/pythonlibs .. Python imaging projects .. _PyMVPA: http://www.pymvpa.org diff --git a/doc/users/installation.rst b/doc/users/installation.rst index 7fb508c327..c65c132f83 100644 --- a/doc/users/installation.rst +++ b/doc/users/installation.rst @@ -1,75 +1,150 @@ .. _installation: -==================== +#################### Download and Install -==================== +#################### This page covers the necessary steps to install and run NIPY. Below is a list of required dependencies, along with additional software recommendations. -NIPY is currently *ALPHA* quality, but is rapidly improving. - -Dependencies ------------- +************************ +Dependencies for install +************************ Must Have -^^^^^^^^^ +========= - Python_ 2.5 or later +* Python_ 2.5 or later +* NumPy_ 1.2 or later: Numpy is an array library for Python +* SciPy_ 0.7 or later: Scipy contains scientific computing libraries based on + numpy +* Sympy_ 0.6.6 or later: Sympy is a symbolic mathematics library for Python. We + use it for statistical formulae. - NumPy_ 1.2 or later +Strong Recommendations +====================== - SciPy_ 0.7 or later - Numpy and Scipy are high-level, optimized scientific computing libraries. +* IPython_: Interactive Python environment. +* Matplotlib_: python plotting library. - Sympy_ 0.6.6 or later - Sympy is a symbolic mathematics library for Python. We use it for - statistical formalae. +Installing from binary packages +=============================== +For Debian or Ubuntu +-------------------- -Must Have to Build -^^^^^^^^^^^^^^^^^^ +Please use the NeuroDebian_ repository, and install with:: -If your OS/distribution does not provide you with binary build of -NIPY, you would need few additional components to be able to build -NIPY directly from sources + sudo apt-get install python-nipy - gcc_ - NIPY does contain a few C extensions for optimized - routines. Therefore, you must have a compiler to build from - source. XCode_ (OSX) and MinGW_ (Windows) both include gcc. +This will install the dependencies for you. - cython_ 0.11.1 or later - Cython is a language that is a fusion of Python and C. It allows us - to write fast code using Python and C syntax, so that it easier to - read and maintain. +For Fedora, CentOS +------------------ +:: -Strong Recommendations -^^^^^^^^^^^^^^^^^^^^^^ + sudo yum install numpy scipy sympy python-setuptools + sudo yum install python-devel gcc + sudo easy_install nibabel + sudo easy_install nipy - iPython_ - Interactive Python environment. +For OSX +^^^^^^^ - Matplotlib_ - 2D python plotting library. +Install Python, Numpy, and Scipy via their respective ``dmg`` installers. +Install via distribute_ / setuptools_ and ``easy_install``. See the distribute_ +page for how to install ``easy_install`` and related tools. Then (from the +command prompt):: -Installing from binary packages -------------------------------- + easy_install nipy + +For Windows +^^^^^^^^^^^ + +Option 1 +"""""""" + +You can make your life much easier by using `Python (X, Y)`_. This will install +Python, Numpy, Scipy, IPython, Matplotlib, Sympy and many other useful things. + +Then go to `nipy pypi`_ and download the ``.exe`` installer for nipy. Double click +to install. + +Option 2 +"""""""" + +* Download Python_ and install with the ``exe`` or ``msi`` installer +* Download and install the "Scipy stack" from Christophe Gohlke's `unofficial + windows binaries`_. +* If the nipy version on the `unofficial windows binaries`_ page is current, use + that, otherwise, go to `nipy pypi`_, download and install the ``exe`` + installer for nipy + +Option 3 +"""""""" + +Consider one of the big Python bundles such as `EPD free`_ or `Anaconda CE`_ for +the dependencies. Install nipy from the ``exe`` installer at `nipy pypi`_. + +Option 4 +"""""""" + +Do all the installs by hand: + +* Download Python_ and install with the ``exe`` or ``msi`` installer. Make sure + your python and the scripts directory (say, ``c:\Python27\Scripts``) are on + your windows path. +* Download Numpy and Scipy ``exe`` installers for your Python version from their + respective Numpy and Scipy download sites. +* Install distribute_ to give you ``easy_install``. +* Install pip_ using ``easy_install`` from a windows ``cmd`` shell:: -Currently we have binary packages for snapshot releases only for -Debian-based systems. Stock Debian_ and Ubuntu_ installations come -with some snapshot of NiPy available. For more up-to-date packages of -NiPy you can use NeuroDebian_ repository. For the other OSes and -Linux distributions, the easiest installation method is to download -the source tarball and follow the :ref:`building_source` instructions -below. + easy_install pip + +* Install sympy and nibabel using pip from a window ``cmd`` shell:: + + pip install sympy + pip install nibabel + +* On 32-bit Windows, install nipy using ``easy_install``:: + + easy_install nipy + + This will pick up and use the ``exe`` installer. For 64-bits install use the + installer at the `unofficial windows binaries`_ site. + +Otherwise +^^^^^^^^^ + +I'm afraid you might need to build from source... .. _building_source: +************************* Building from source code -------------------------- +************************* + +Dependencies for build +====================== + +* A C compiler: NIPY does contain a few C extensions for optimized routines. + Therefore, you must have a compiler to build from source. XCode_ (OSX) and + MinGW_ (Windows) both include a C compiler. On Linux, try ``sudo apt-get + build-essential`` on Debian / Ubuntu, ``sudo yum install gcc`` on Fedora and + related distributions. + +Recommended for build +===================== + +* Cython_ 0.12.1 or later: Cython is a language that is a fusion of Python and + C. It allows us to write fast code using Python and C syntax, so that it + easier to read and maintain. You don't need it to build a release, unless you + modify the Cython ``*.pyx`` files in the nipy distribution. + +Procedure +========= Developers should look through the :ref:`development quickstart ` @@ -77,9 +152,9 @@ documentation. There you will find information on building NIPY, the required software packages and our developer guidelines. If you are primarily interested in using NIPY, download the source -tarball (e.g. from `nipy github`_) and follow these instructions for building. The installation -process is similar to other Python packages so it will be familiar if -you have Python experience. +tarball from `nipy pypi` and follow these instructions for building. The +installation process is similar to other Python packages so it will be familiar +if you have Python experience. Unpack the source tarball and change into the source directory. Once in the source directory, you can build the neuroimaging package using:: @@ -92,17 +167,24 @@ To install, simply do:: .. note:: - As with any Python_ installation, this will install the modules - in your system Python_ *site-packages* directory (which is why you - need *sudo*). Many of us prefer to install development packages in a - local directory so as to leave the system python alone. This is - merely a preference, nothing will go wrong if you install using the - *sudo* method. To install in a local directory, use the **--prefix** - option. For example, if you created a ``local`` directory in your - home directory, you would install nipy like this:: + As with any Python installation, this will install the modules in your + system Python *site-packages* directory (which is why you need *sudo*). + Many of us prefer to install development packages in a local directory so as + to leave the system python alone. This is merely a preference, nothing will + go wrong if you install using the *sudo* method. + + If you have Python 2.6 or later, you might want to do a `user install + `_ + + python setup.py install --user + + To install nipy in some other local directory, use the **--prefix** option. + For example, if you created a ``local`` directory in your home directory, + you would install nipy like this:: python setup.py install --prefix=$HOME/local + Installing useful data files ----------------------------- From ee97500db02b456a4c898216f279a86eb345c411 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 2 Feb 2013 13:49:04 -0800 Subject: [PATCH 124/164] DOC: update README and info * Note python 3 compatibility. * Correct compatible versions in info.py * Replace deprecated github downloads link with pypi * Update ourselves to beta from alpha (high fives all round) --- README.rst | 4 ++-- nipy/info.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index b1e2c5f1a3..1028a6e3fc 100644 --- a/README.rst +++ b/README.rst @@ -54,14 +54,14 @@ You can find our sources and single-click downloads: .. _main repository: http://github.com/nipy/nipy .. _Documentation: http://nipy.org/nipy .. _current trunk: http://github.com/nipy/nipy/archives/master -.. _available releases: http://github.com/nipy/nipy/downloads +.. _available releases: http://pypi.python.org/pypi/nipy Dependencies ============ To run NIPY, you will need: -* python_ >= 2.5. We don't yet run on python 3, sad to say. +* python_ >= 2.5 (tested with 2.5, 2.6, 2.7, 3.2, 3.3) * numpy_ >= 1.2 * scipy_ >= 0.7.0 * sympy_ >= 0.6.6 diff --git a/nipy/info.py b/nipy/info.py index 4b1f77b60e..1616274b1c 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -85,14 +85,14 @@ .. _main repository: http://github.com/nipy/nipy .. _Documentation: http://nipy.org/nipy .. _current trunk: http://github.com/nipy/nipy/archives/master -.. _available releases: http://github.com/nipy/nipy/downloads +.. _available releases: http://pypi.python.org/pypi/nipy Dependencies ============ To run NIPY, you will need: -* python_ >= 2.5. We don't yet run on python 3, sad to say. +* python_ >= 2.5 (tested with 2.5, 2.6, 2.7, 3.2, 3.3) * numpy_ >= 1.2 * scipy_ >= 0.7.0 * sympy_ >= 0.6.6 @@ -138,11 +138,11 @@ ISRELEASE = _version_extra == '' VERSION = __version__ REQUIRES = ["numpy", "scipy", "sympy"] -STATUS = 'alpha' +STATUS = 'beta' # versions NUMPY_MIN_VERSION='1.2' -SCIPY_MIN_VERSION = '0.5' +SCIPY_MIN_VERSION = '0.7' NIBABEL_MIN_VERSION = '1.2' SYMPY_MIN_VERSION = '0.6.6' MAYAVI_MIN_VERSION = '3.0' From 965ecfc8ab85a959fd8937b929afbf47a40ebe66 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 02:01:21 -0800 Subject: [PATCH 125/164] DOC: updating release instructions for buildbots Making various checks and binary builds via buildbots. --- doc/devel/guidelines/make_release.rst | 190 ++++++-------------------- doc/links_names.txt | 1 + 2 files changed, 44 insertions(+), 147 deletions(-) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index fd542adb03..c96d2e11d8 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -72,7 +72,7 @@ Release checklist * Do a final check on the `nipy buildbot`_ -* If you have travis-ci_ building set up you might want to push the code in it's +* If you have travis-ci_ building set up you might want to push the code in its current state to a branch that will build, e.g:: git branch -D pre-release-test # in case branch already exists @@ -84,42 +84,33 @@ Release checklist ./tools/nicythize -* Compile up the code for testing:: +Release checking - buildbots +============================ - python setup.py build_ext -i +* Check all the buildbots pass +* Run the builder and review the possibly green output from + http://nipy.bic.berkeley.edu/builders/nipy-release-checks -* Make sure all tests pass (from the nipy root directory):: - - ./tools/nipnost nipy - -* Clean:: + This runs all of:: make distclean - -* Make sure all tests pass from sdist:: - + python -m compileall . make sdist-tests - - and bdist_egg:: - make bdist-egg-tests + make check-version-info + make check-files - This one may well fail because of a problem with the script tests; if you have - a recent (>= Jan 15 2013) nibabel ``nisext`` package, you could try instead - doing:: +* You need to review the outputs for errors; at the moment this buildbot builder + does not check whether these tests passed or failed. +* ``make bdist-egg-tests`` may well fail because of a problem with the script + tests; if you have a recent (>= Jan 15 2013) nibabel ``nisext`` package, you + could try instead doing:: python -c 'from nisext.testers import bdist_egg_tests; bdist_egg_tests("nipy", label="not slow and not script_test")' Eventually we should update the ``bdist-egg-tests`` makefile target. - -* Check the installation commit hash storage. - - This checks the three ways of installing (from tarball, repo, local in repo):: - - make check-version-info - - The last may not raise any errors, but you should detect in the output - lines of this form:: +* ``make check-version-info`` checks how the commit hash is stored in the + installed files. You should see something like this:: {'sys_version': '2.6.6 (r266:84374, Aug 31 2010, 11:00:51) \n[GCC 4.0.1 (Apple Inc. build 5493)]', 'commit_source': 'archive substitution', 'np_version': '1.5.0', 'commit_hash': '25b4125', 'pkg_path': '/var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-/tmpGPiD3E/pylib/nipy', 'sys_executable': '/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'sys_platform': 'darwin'} /var/folders/jg/jgfZ12ZXHwGSFKD85xLpLk+++TI/-Tmp-/tmpGPiD3E/pylib/nipy/__init__.pyc @@ -127,18 +118,16 @@ Release checklist /Users/mb312/dev_trees/nipy/nipy/__init__.pyc {'sys_version': '2.6.6 (r266:84374, Aug 31 2010, 11:00:51) \n[GCC 4.0.1 (Apple Inc. build 5493)]', 'commit_source': 'repository', 'np_version': '1.5.0', 'commit_hash': '25b4125', 'pkg_path': '/Users/mb312/dev_trees/nipy/nipy', 'sys_executable': '/Library/Frameworks/Python.framework/Versions/2.6/Resources/Python.app/Contents/MacOS/Python', 'sys_platform': 'darwin'} -* Check the ``setup.py`` file is picking up all the library code and scripts, - with:: - - make check-files - - Look for output at the end about missed files, such as:: +* ``make check-files`` checks if the source distribution is picking up all the + library and script files. Look for output at the end about missed files, such + as:: Missed script files: /Users/mb312/dev_trees/nipy/bin/nib-dicomfs, /Users/mb312/dev_trees/nipy/bin/nifti1_diagnose.py Fix ``setup.py`` to carry across any files that should be in the distribution. - -* You probably have virtualenvs for different python versions. Check the tests +* Check the documentation doctests pass from + http://nipy.bic.berkeley.edu/builders/nipy-doc-builder +* You may have virtualenvs for different python versions. Check the tests pass for different configurations. If you have pytox_ and a network connection, and lots of pythons installed, you might be able to do:: @@ -166,36 +155,8 @@ Release checklist etc for the different virtualenvs. -* Check on different platforms, particularly windows and PPC. I have wine - installed on my Mac, and git bash installed under wine. I run bash and the - tests like this:: - - wineconsole bash - # in wine bash - make sdist-tests - - For the PPC I have to log into a MacPro in Berkeley at - ``alexis.bic.berkeley.edu``. Here's an example session:: - - ssh alexis.bic.berkeley.edu - cd dev_trees/nipy - git co main-master - git pull - make sdist-tests - -* Check the documentation doctests:: - - cd doc - make doctest - cd .. - - You will need an importable version of NIPY on the python path to do this - check. - -* Check everything compiles without syntax errors:: - - make distclean - python -m compileall . +Doing the release +================= * The release should now be ready. @@ -226,81 +187,32 @@ Release checklist python setup.py register python setup.py sdist --formats=gztar,zip upload -* Then upload the binary release for the platform you are currently on:: - - python setup.py bdist_egg upload - -* Do binary builds for any virtualenvs you have:: - - workon python25 - python setup.py bdist_egg upload - deactivate - - etc. (``workon`` is a virtualenvwrapper command). - - For OSX and python 2.5 only, the installation didn't recognize it was doing a fat (i386 + PPC) - build, and build with name ``dipy-0.5.0-py2.5-macosx-10.3-i386.egg``. I tried - to tell it to use ``fat`` and ``universal`` in the name, but uploading these - tp pypi didn't result in in easy_install finding them. In the end did the - standard:: - - python setup.py bdist_egg upload - - which uploaded the 'i386' egg, followed by:: +* Trigger binary builds for Windows from the buildbots. See builders + ``nipy-bdist32-26``, ``nipy-bdist32-27``, ``nipy-bdist32-32``. The ``exe`` + builds will appear in http://nipy.bic.berkeley.edu/nipy-dist . Download the + builds and upload to pypi. - python setup.py bdist_egg --plat-name macosx-10.3-ppc upload +* Trigger binary builds for OSX from the buildbots ``nipy-bdist-mpkg-2.6``, + ``nipy-bdist-mpkg-2.7``, ``nipy-bdist-mpkg-3.3``. ``egg`` and ``mpkg`` builds + will appear in http://nipy.bic.berkeley.edu/nipy-dist . Download the eggs and + upload to pypi. - which may or may not work to allow easy_install to find the egg for PPC. It - does work for easy_install on my Intel machine. I found the default platform - name with ``python setup.py bdist_egg --help``. +* Download the ``mpkg`` builds, maybe with:: - When trying to upload in python25, after previously saving my ``~/.pypirc`` - during the initial ``register`` step, I got a configparser error. I found - `this python 2.5 pypirc page - `_ and so hand edited - the ``~/.pypirc`` file to have a new section:: + scp -r buildbot@nipy.bic.berkeley.edu:nibotmi/public_html/nipy-dist/*.mpkg . - [server-login] - username:my-username - password:my-password - - after which python25 upload seemed to go smoothly. - -* Building OSX dmgs. This is very unpleasant. - - See `MBs OSX setup - `_). - - The problem here is that we need to run the package build as root, so that the - files have root permissions when installed from the installer. We also can't - use virtualenvs, because the installer needs to find the correct system path - into which to install - so the python ``sys.prefix`` has to be e.g. - ``/Library/Frameworks/Python.framework/Versions/2.6``. What I ended up doing - was to make a script to set paths etc from a handy virtualenv, but run the - relevant system python, as root. See the crude, fragile ``tools/pythonsudo`` - bash script for details. The procedure then:: - - sudo ./tools/pythonsudo 5 - make clean - python tools/osxbuild.py - - The ``osxbuild.py`` script comes from numpy and uses the ``bdist_mpkg`` script - we might have installed above. + Make sure you have `github bdist_mpkg`_ installed, for the root user. For + each ``mpkg`` directory, run:: -* Repeat binary builds for Linux 32, 64 bit and OS X. + sudo reown_mpkg nipy-0.3.0.dev-py2.6-macosx10.6.mpkg root admin + zip -r nipy-0.3.0.dev-py2.6-macosx10.6.mpkg.zip nipy-0.3.0.dev-py2.6-macosx10.6.mpkg -* Get to a windows machine and do egg and wininst builds:: + Upload the ``mpkg.zip`` files. (At the moment, these don't seem to store the + scripts - needs more work) - make distclean - c:\Python26\python.exe setup.py bdist_egg upload - c:\Python26\python.exe setup.py bdist_wininst --target-version=2.6 register upload - - Maybe virtualenvs for the different versions of python? I haven't explored - that yet. +* Tag the release with tag of form ``0.3.0``:: -* Tag the release with tag of form ``1.1.0``:: - - git tag -am 'Second main release' 1.1.0 + git tag -am 'Second main release' 0.3.0 * Now the version number is OK, push the docs to sourceforge with:: @@ -341,22 +253,6 @@ Release checklist git push --tags -* Make next development release tag - - After each release the master branch should be tagged - with an annotated (or/and signed) tag, naming the intended - next version, plus an 'upstream/' prefix and 'dev' suffix. - For example 'upstream/1.0.0.dev' means "development start - for upcoming version 1.0.0. - - This tag is used in the Makefile rules to create development snapshot - releases to create proper versions for those. The version derives its name - from the last available annotated tag, the number of commits since that, and - an abbreviated SHA1. See the docs of ``git describe`` for more info. - - Please take a look at the Makefile rules ``devel-src``, - ``devel-dsc`` and ``orig-src``. - * Announce to the mailing lists. .. _pytox: http://codespeak.net/tox diff --git a/doc/links_names.txt b/doc/links_names.txt index 6a0009c546..a6b3b1d4f6 100644 --- a/doc/links_names.txt +++ b/doc/links_names.txt @@ -68,6 +68,7 @@ .. _old and new python versions: https://launchpad.net/%7Efkrull/+archive/deadsnakes .. _pypi: http://pypi.python.org .. _example pypi: http://packages.python.org/an_example_pypi_project/setuptools.html#intermezzo-pypirc-file-and-gpg +.. _github bdist_mpkg: https://github.com/matthew-brett/bdist_mpkg .. Code support stuff .. _pychecker: http://pychecker.sourceforge.net/ From afed8d833fc292d65579cf3d1ac03afeb99000bd Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 02:59:08 -0800 Subject: [PATCH 126/164] REL: release 0.3.0 Update release version --- nipy/info.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nipy/info.py b/nipy/info.py index 1616274b1c..deac69a412 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -9,7 +9,8 @@ _version_major = 0 _version_minor = 3 _version_micro = 0 -_version_extra = '.dev' +#_version_extra = '.dev' # For development +_version_extra = '' # For release # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" __version__ = "%s.%s.%s%s" % (_version_major, From 7df3c54a8b4c73ee771937a781c7df2eb29bd2df Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 04:19:11 -0800 Subject: [PATCH 127/164] MISC: start 0.3.x maintenance branch --- nipy/info.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipy/info.py b/nipy/info.py index deac69a412..15317192ef 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -8,9 +8,9 @@ # version _version_major = 0 _version_minor = 3 -_version_micro = 0 -#_version_extra = '.dev' # For development -_version_extra = '' # For release +_version_micro = 1 +_version_extra = '.dev' # For development +#_version_extra = '' # For release # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" __version__ = "%s.%s.%s%s" % (_version_major, From b2c8600962d3345a1215fa84f9153a8be53e148e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 04:20:46 -0800 Subject: [PATCH 128/164] MISC: start 0.4.0 development --- nipy/info.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nipy/info.py b/nipy/info.py index deac69a412..323d8d7694 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -7,10 +7,10 @@ # full release. '.dev' as a _version_extra string means this is a development # version _version_major = 0 -_version_minor = 3 +_version_minor = 4 _version_micro = 0 -#_version_extra = '.dev' # For development -_version_extra = '' # For release +_version_extra = '.dev' # For development +#_version_extra = '' # For release # Format expected by setup.py and doc/source/conf.py: string of form "X.Y.Z" __version__ = "%s.%s.%s%s" % (_version_major, From 0e4d355c19f5f18758d674103bc39754bcc9b0ef Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 04:26:24 -0800 Subject: [PATCH 129/164] DOC: note -s ours merge of maintenance branch The -s ours merge allows us to merge later from the maintenance branch if there's any useful work on there. --- doc/devel/guidelines/make_release.rst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index c96d2e11d8..ff66224521 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -246,6 +246,13 @@ Doing the release Thus the development series ('trunk') will have a version number here of '0.3.0.dev' and the next full release will be '0.3.0'. + * Merge ``-s ours`` the version number changes from the maint release, e.g:: + + git merge -s ours maint/0.3.x + + This marks the version number changes commit as merged, so we can merge any + changes we need from the maintenance branch without merge conflicts. + If this is just a maintenance release from ``maint/0.2.x`` or similar, just tag and set the version number to - say - ``0.2.1.dev``. From 8ba6295347866181e21a5d3a28b4f632ae0ee130 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 04:42:20 -0800 Subject: [PATCH 130/164] DOC: update copyright dates; note need to check We need to update the year on the copyright dates from time to time. --- LICENSE | 2 +- doc/conf.py | 2 +- doc/devel/guidelines/make_release.rst | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/LICENSE b/LICENSE index 84661ed78e..2b6b252f66 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2006-2012, NIPY Developers +Copyright (c) 2006-2013, NIPY Developers All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/doc/conf.py b/doc/conf.py index 9f1e1c4f8e..bca72c7bb9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -60,7 +60,7 @@ project = 'nipy' #copyright = ':ref:`2005-2010, Neuroimaging in Python team. `' -copyright = '2005-2012, Neuroimaging in Python team' +copyright = '2005-2013, Neuroimaging in Python team' # The default replacements for |version| and |release|, also used in various # other places throughout the built documents. diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index ff66224521..c7d0a9d0a1 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -57,6 +57,8 @@ Release checklist * Use the opportunity to update the ``.mailmap`` file if there are any duplicate authors listed from ``git shortlog``. +* Check the copyright years in ``doc/conf.py`` and ``LICENSE`` + * Check the examples in python 2 and python 3, by running something like:: cd .. From 4912513c8b5519abb73df5547a14d7711c684981 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sun, 3 Feb 2013 04:44:24 -0800 Subject: [PATCH 131/164] DOC: reminder to update AUTHORs and THANKS --- doc/devel/guidelines/make_release.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index c7d0a9d0a1..6c258307b0 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -57,6 +57,9 @@ Release checklist * Use the opportunity to update the ``.mailmap`` file if there are any duplicate authors listed from ``git shortlog``. +* Add any new authors to the ``AUTHORS`` file. Add any new entries to the + ``THANKS`` file. + * Check the copyright years in ``doc/conf.py`` and ``LICENSE`` * Check the examples in python 2 and python 3, by running something like:: From d5b54d162a43db0da4ba18ee929c0f1e56431298 Mon Sep 17 00:00:00 2001 From: endolith Date: Tue, 5 Feb 2013 14:52:55 -0500 Subject: [PATCH 132/164] Update doc/faq/johns_bsd_pitch.rst add some fixes from http://mail.scipy.org/pipermail/scipy-user/2007-January/010602.html --- doc/faq/johns_bsd_pitch.rst | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/doc/faq/johns_bsd_pitch.rst b/doc/faq/johns_bsd_pitch.rst index 79db58ed34..67caf6f32c 100644 --- a/doc/faq/johns_bsd_pitch.rst +++ b/doc/faq/johns_bsd_pitch.rst @@ -22,7 +22,7 @@ The best known and perhaps most widely used license is the :term:`GPL`, which in addition to granting you full rights to the source code including redistribution, carries with it an extra obligation. If you use GPL code in your own code, or link with it, -your product must be released under a GPL compatible license. Ie you +your product must be released under a GPL compatible license. I.e., you are required to give the source code to other people and give them the right to redistribute it as well. Many of the most famous and widely used open source projects are released under the GPL, including linux, @@ -33,7 +33,7 @@ The second major class are the :term:`BSD` and BSD-style licenses allow you to do whatever you want with the code: ignore it, include it in your own open source project, include it in your proprietary product, sell it, whatever. python itself is released under a BSD -compatible license, in the sense that, now quoting form the PSF +compatible license, in the sense that, quoting from the PSF license page There is no GPL-like "copyleft" restriction. Distributing @@ -43,7 +43,8 @@ license page form. Famous projects released under a BSD-style license in the permissive -sense of the last paragraph are the BSD operating system, python and !TeX.h +sense of the last paragraph are the BSD operating system, python, and +TeX. I believe the choice of license is an important one, and I advocate a BSD-style license. In my experience, the most important commodity an @@ -58,16 +59,16 @@ especially if they have some skills and find a feature they need implemented, or if they have a thesis to write. Once you have a lot of users and a number of developers, a network effect kicks in, exponentially increasing your users and developers. In open source -parlance, this is called competing for mind share. +parlance, this is sometimes called competing for mind share. So I believe the number one (or at least number two) commodity an open -source project can possess is mind share, and mind share means you +source project can possess is mind share, which means you want as many damned users using your software as you can get. Even though you are giving it away for free, you have to market your software, promote it, and support it as if you were getting paid for -it. Now, how does this relate to licensing, you are asking? +it. Now, how does this relate to licensing, you are asking? -Most software companies will not use GPL'd code in their own software, +Most software companies will not use GPL code in their own software, even those that are highly committed to open source development, such as enthought_, out of legitimate concern that use of the GPL will "infect" their code base by its viral nature. In effect, they want to @@ -83,14 +84,14 @@ are real, whereas the fear that some private company will "steal" your product and sell it in a proprietary application leaving you with nothing is not. -There is a lot of GPLd code in the world, and it is a constant reality +There is a lot of GPL code in the world, and it is a constant reality in the development of matplotlib that when we want to reuse some -algorithm, we have to go on a hunt for a non-GPLd version. Most +algorithm, we have to go on a hunt for a non-GPL version. Most recently this occurred in a search for a good contouring algorithm. I worry that the "license wars", the effect of which are starting to be felt on many projects, have a potential to do real harm to open source software development. There are two unpalatable options. 1) Go with -GPL and lose the mind-share of the private sector 2) Forgo GPLd code +GPL and lose the mind-share of the private sector 2) Forgo GPL code and retain the contribution of the private sector. This is a very tough decision because their is a lot of very high quality software that is GPLd and we need to use it; they don't call the license `viral @@ -106,15 +107,15 @@ consider issues such as those raised here when choosing a license. When asked, these developers will often be amenable to re-releasing their code under a more permissive license. Fernando Perez did this with ipython, which was released under the :term:`LGPL` and then -re-released under a BSD license to ease integration with scipy and -other enthought products. The LGPL is more permissive than the GPL, +re-released under a BSD license to ease integration with matplotlib, +scipy and enthought code. The LGPL is more permissive than the GPL, allowing you to link with it non-virally, but many companies are still loath to use it out of legal concerns, and you cannot reuse LGPL code in a proprietary product. So I encourage you to release your code under a BSD compatible license, and when you encounter an open source developer whose code -you want to use, to do the same. Feel free to forward this document -on them. +you want to use, encourage them to do the same. Feel free to forward +this document to them. .. include:: ../links_names.txt From 5beb8ea948e9464df7ee2afa0bf740231bdad0f5 Mon Sep 17 00:00:00 2001 From: endolith Date: Tue, 5 Feb 2013 15:00:49 -0500 Subject: [PATCH 133/164] "their is" -> "there is" --- doc/faq/johns_bsd_pitch.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/faq/johns_bsd_pitch.rst b/doc/faq/johns_bsd_pitch.rst index 67caf6f32c..d02ff38ad2 100644 --- a/doc/faq/johns_bsd_pitch.rst +++ b/doc/faq/johns_bsd_pitch.rst @@ -93,7 +93,7 @@ felt on many projects, have a potential to do real harm to open source software development. There are two unpalatable options. 1) Go with GPL and lose the mind-share of the private sector 2) Forgo GPL code and retain the contribution of the private sector. This is a very -tough decision because their is a lot of very high quality software +tough decision because there is a lot of very high quality software that is GPLd and we need to use it; they don't call the license `viral `_ for nothing. From 66c0223b0ac18901f24284c7b27118e99542466b Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 6 Feb 2013 18:44:16 +0100 Subject: [PATCH 134/164] BF: fixed the dtype issue by forcing the type to np.float64 --- nipy/algorithms/graph/field.py | 12 ++++++++---- nipy/algorithms/graph/tests/test_field.py | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/nipy/algorithms/graph/field.py b/nipy/algorithms/graph/field.py index c9736b671f..3c140fe671 100644 --- a/nipy/algorithms/graph/field.py +++ b/nipy/algorithms/graph/field.py @@ -12,6 +12,7 @@ Author:Bertrand Thirion, 2006--2011 """ +from warnings import warn import numpy as np from .graph import WeightedGraph @@ -155,13 +156,16 @@ def dilation(self, nbiter=1, fast=True): ---------- nbiter: int, optional, the number of iterations required - fixme - ----- - cython + Caveat + ------ + A conversion to np.float64 is performed automatically """ nbiter = int(nbiter) if fast: from ._graph import dilation + if self.field.dtype != np.float64: + warn('A conversion to float64 has been performed') + self.field = self.field.astype(np.float64) if self.E > 0: if (self.field.size == self.V): self.field = self.field.reshape((self.V, 1)) @@ -262,7 +266,7 @@ def local_maxima(self, refdim=0, th=NEGINF): # create a subfield(thresholding) sf = self.subfield(self.field.T[refdim] >= th) - initial_field = sf.field.T[refdim] + initial_field = sf.field.T[refdim].astype(np.float64) sf.field = initial_field.copy() # compute the depth in the subgraph diff --git a/nipy/algorithms/graph/tests/test_field.py b/nipy/algorithms/graph/tests/test_field.py index cafb141530..2400cb69b6 100644 --- a/nipy/algorithms/graph/tests/test_field.py +++ b/nipy/algorithms/graph/tests/test_field.py @@ -47,6 +47,12 @@ def basic_graph(nx=10, ny=10, nz=10): F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) return F +def test_type_local_max(): + f = basic_field() + f.field = f.field.astype(np.float32) + idx, depth = f.get_local_maxima(th=0) + assert_array_equal(idx, np.array([999])) + class test_Field(TestCase): From c5d485359aaa696d316b4b9ac7240fad3d27d67a Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 6 Feb 2013 19:11:21 +0100 Subject: [PATCH 135/164] COSMIT: Cleaned test_field --- nipy/algorithms/graph/tests/test_field.py | 491 +++++++++++----------- 1 file changed, 252 insertions(+), 239 deletions(-) diff --git a/nipy/algorithms/graph/tests/test_field.py b/nipy/algorithms/graph/tests/test_field.py index 2400cb69b6..2899dec2cb 100644 --- a/nipy/algorithms/graph/tests/test_field.py +++ b/nipy/algorithms/graph/tests/test_field.py @@ -1,5 +1,6 @@ #!/usr/bin/env python import numpy as np +import numpy.random as nr from ..field import (field_from_coo_matrix_and_data, field_from_graph_and_data) @@ -7,45 +8,45 @@ from nose.tools import assert_true, assert_equal -from numpy.testing import TestCase, assert_array_equal +from numpy.testing import assert_array_equal def basic_field(nx=10, ny=10, nz=10): xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T - data = np.sum(xyz, 1).astype('d') - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) - return F + data = np.sum(xyz, 1).astype(np.float) + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) + return myfield def basic_field_random(nx=10, ny=10, nz=1): - import numpy.random as nr xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T - data = 0.5 * nr.randn(nx * ny * nz, 1) + np.sum(xyz, 1).astype('d') - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) - return F + data = 0.5 * nr.randn(nx * ny * nz, 1) + np.sum(xyz, 1).astype(np.float) + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) + return myfield def basic_field_2(nx=10, ny=10, nz=10): xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T toto = xyz - np.array([5, 5, 5]) data = np.sum(toto ** 2, 1) - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) - return F + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) + return myfield def basic_field_3(nx=10, ny=10, nz=10): xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T toto = xyz - np.array([5, 5, 5]) data = np.abs(np.sum(toto ** 2, 1) - 11 ) - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) - return F + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) + return myfield def basic_graph(nx=10, ny=10, nz=10): xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T data = np.zeros(xyz.shape[0]) - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) - return F + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 26), data) + return myfield + def test_type_local_max(): f = basic_field() @@ -54,232 +55,244 @@ def test_type_local_max(): assert_array_equal(idx, np.array([999])) -class test_Field(TestCase): - - def test_max_1(self): - F = basic_field() - F.field[555] = 30 - depth = F.local_maxima() - dep = np.zeros(1000, np.int) - dep[555] = 5 - dep[999] = 3 - assert_true(sum(np.absolute(dep-depth))<1.e-7) - - def test_max_2(self): - F = basic_field() - F.field[555] = 28 - idx,depth = F.get_local_maxima() - self.assert_(len(idx) == 2) - self.assert_(np.alltrue( idx == (555, 999))) - self.assert_(np.alltrue( depth == (5, 3))) - - def test_max_3(self): - F = basic_field() - F.field[555] = 27 - idx, depth = F.get_local_maxima() - assert_true(np.size(idx) == 2) - assert_true(idx[0] == 555) - assert_true(idx[1] == 999) - assert_true(depth[0] == 5) - assert_true(depth[1] == 5) - - def test_max_4(self): - F = basic_field() - F.field[555] = 28 - idx, depth = F.get_local_maxima(0, 27.5) - assert_true(np.size(idx) == 1) - assert_true(idx[0] == 555) - assert_true(depth[0] == 1) - - def test_smooth_1(self): - G = basic_graph() - field = np.zeros((1000,1)) - field[555,0] = 1 - G.set_field(field) - G.diffusion() - sfield = G.get_field() - OK1 = (sfield[555]==0) - OK2 = (sfield[554]==1) - OK3 = (np.absolute(sfield[566]-np.sqrt(2))<1.e-7) - OK4 = (np.absolute(sfield[446]-np.sqrt(3))<1.e-7) - OK = OK1 & OK2 & OK3 & OK4 - self.assert_(OK) - - def test_smooth_2(self): - G = basic_graph() - field = np.zeros((1000,1)) - field[555,0] = 1 - G.set_field(field) - G.diffusion(1) - sfield = G.get_field() - OK1 = (sfield[555]==0) - OK2 = (sfield[554]==1) - OK3 = (np.absolute(sfield[566]-np.sqrt(2))<1.e-7) - OK4 = (np.absolute(sfield[446]-np.sqrt(3))<1.e-7) - OK = OK1 & OK2 & OK3 & OK4 - self.assert_(OK) - - def test_dilation(self): - F = basic_field() - F.field[555] = 30 - F.field[664] = 0 - F.dilation(2) - assert_true(F.field[737] == 30) - assert_true(F.field[0] == 6) - assert_true(F.field[999] == 27) - assert_true(F.field[664] == 30) - - def test_dilation2(self): - # test equality of cython and python versions - F = basic_field() - F.field[555] = 30 - F.field[664] = 0 - h = F.copy() - h.dilation(2) - g = F.copy() - g.dilation(2, False) - assert_array_equal(h.field, g.field) - - def test_erosion(self): - F = basic_field() - F.field[555] = 30 - F.field[664] = 0 - F.erosion(2) - field = F.get_field() - assert_true(field[737] == 11) - assert_true(field[0] == 0) - assert_true(field[999] == 21) - assert_true(field[664] == 0) - - def test_opening(self): - F = basic_field() - F.field[555] = 30 - F.field[664] = 0 - F.opening(2) - field = F.get_field() - assert_true(field[737] == 17) - assert_true(field[0] == 0) - assert_true(field[999] == 21) - assert_true(field[555] == 16) - - def test_closing(self): - F = basic_field() - F.field[555] = 30 - F.field[664] = 0 - F.closing(2) - field = F.get_field() - assert_true(field[737] == 17) - assert_true(field[0] == 6) - assert_true(field[999] == 27) - assert_true(field[555] == 30) - - def test_watershed_1(self): - F = basic_field() - F.field[555] = 28 - F.field[664] = 0 - idx, label = F.custom_watershed() - assert_equal(np.size(idx), 2) - assert_equal(tuple(idx), (555, 999)) - assert_equal((label[776], label[666], label[123]), (1, 0, 0)) - - def test_watershed_4(self): - F = basic_field_3() - idx, label = F.custom_watershed() - assert_true(np.size(idx) == 9) - assert_true(np.unique( +def test_max_1(): + myfield = basic_field() + myfield.field[555] = 30 + depth = myfield.local_maxima() + dep = np.zeros(1000, np.int) + dep[555] = 5 + dep[999] = 3 + assert_true(sum(np.absolute(dep-depth)) < 1.e-7) + + +def test_max_2(): + myfield = basic_field() + myfield.field[555] = 28 + idx, depth = myfield.get_local_maxima() + assert_true(len(idx) == 2) + assert_array_equal(idx, np.array([555, 999])) + assert_array_equal(depth, np.array([5, 3])) + + +def test_max_3(): + myfield = basic_field() + myfield.field[555] = 27 + idx, depth = myfield.get_local_maxima() + assert_equal(np.size(idx), 2) + assert_equal(idx[0], 555) + assert_equal(idx[1], 999) + assert_equal(depth[0], 5) + assert_equal(depth[1], 5) + + +def test_max_4(): + myfield = basic_field() + myfield.field[555] = 28 + idx, depth = myfield.get_local_maxima(0, 27.5) + assert_equal(np.size(idx), 1) + assert_equal(idx[0], 555) + assert_equal(depth[0], 1) + + +def test_smooth_1(): + G = basic_graph() + field = np.zeros((1000,1)) + field[555,0] = 1 + G.set_field(field) + G.diffusion() + sfield = G.get_field() + assert_equal(sfield[555], 0) + assert_equal(sfield[554], 1) + assert_true(np.abs(sfield[566] - np.sqrt(2)) < 1.e-7) + assert_true(np.abs(sfield[446] - np.sqrt(3)) < 1.e-7) + + +def test_smooth_2(): + G = basic_graph() + field = np.zeros((1000, 1)) + field[555, 0] = 1 + G.set_field(field) + G.diffusion(1) + sfield = G.get_field() + assert_equal(sfield[555], 0) + assert_equal(sfield[554], 1) + assert_true(np.abs(sfield[566] - np.sqrt(2)) < 1.e-7) + assert_true(np.abs(sfield[446] - np.sqrt(3)) < 1.e-7) + + +def test_dilation(): + myfield = basic_field() + myfield.field[555] = 30 + myfield.field[664] = 0 + myfield.dilation(2) + assert_true(myfield.field[737] == 30) + assert_true(myfield.field[0] == 6) + assert_true(myfield.field[999] == 27) + assert_true(myfield.field[664] == 30) + + +def test_dilation2(): + # test equality of cython and python versions + myfield = basic_field() + myfield.field[555] = 30 + myfield.field[664] = 0 + h = myfield.copy() + h.dilation(2) + g = myfield.copy() + g.dilation(2, False) + assert_array_equal(h.field, g.field) + + +def test_erosion(): + myfield = basic_field() + myfield.field[555] = 30 + myfield.field[664] = 0 + myfield.erosion(2) + field = myfield.get_field() + assert_true(field[737] == 11) + assert_true(field[0] == 0) + assert_true(field[999] == 21) + assert_true(field[664] == 0) + + +def test_opening(): + myfield = basic_field() + myfield.field[555] = 30 + myfield.field[664] = 0 + myfield.opening(2) + field = myfield.get_field() + assert_true(field[737] == 17) + assert_true(field[0] == 0) + assert_true(field[999] == 21) + assert_true(field[555] == 16) + + +def test_closing(): + myfield = basic_field() + myfield.field[555] = 30 + myfield.field[664] = 0 + myfield.closing(2) + field = myfield.get_field() + assert_true(field[737] == 17) + assert_true(field[0] == 6) + assert_true(field[999] == 27) + assert_true(field[555] == 30) + + +def test_watershed_1(): + myfield = basic_field() + myfield.field[555] = 28 + myfield.field[664] = 0 + idx, label = myfield.custom_watershed() + assert_equal(np.size(idx), 2) + assert_equal(tuple(idx), (555, 999)) + assert_equal((label[776], label[666], label[123]), (1, 0, 0)) + + +def test_watershed_4(): + myfield = basic_field_3() + idx, label = myfield.custom_watershed() + assert_true(np.size(idx) == 9) + assert_true(np.unique( [label[555], label[0], label[9], label[90], label[99], label[900], - label[909], label[990], label[999]]) - .size == 9) - - def test_watershed_2(self): - F = basic_field_2() - F.field[555] = 10 - F.field[664] = 0 - idx, label = F.custom_watershed() - assert_true(np.size(idx)==9) - - def test_watershed_3(self): - F = basic_field_2() - F.field[555] = 10 - F.field[664] = 0 - idx, label = F.custom_watershed(0,11) - assert_true(np.size(idx)==8) - - def test_bifurcations_1(self): - F = basic_field() - idx, parent,label = F.threshold_bifurcations() - assert_true(idx == 999) - assert_true(parent == 0) - - def test_bifurcations_2(self): - F = basic_field_2() - idx, parent, label = F.threshold_bifurcations() - assert_true(np.size(idx) == 15) - - def test_geodesic_kmeans(self, nbseeds=3): - # Test the geodisc k-means algorithm - import numpy.random as nr - F = basic_field_random(5, 5, 1) - seeds = np.argsort(nr.rand(F.V))[:nbseeds] - seeds, label, inertia = F.geodesic_kmeans(seeds) - for i in range(nbseeds): - assert_true(label[seeds[i]] == i) - print np.unique(label), np.arange(nbseeds) - assert_true(np.array([i in np.unique(label) - for i in np.arange(nbseeds)]).all()) - - def test_constrained_voronoi(self, nbseeds=3): - # Test the geodisc k-means algorithm - import numpy.random as nr - F = basic_field_random() - seeds = np.argsort(nr.rand(F.V))[:nbseeds] - label = F.constrained_voronoi(seeds) - for i in range(nbseeds): - assert_true(label[seeds[i]] == i) - assert_true(np.array([i in np.unique(label) - for i in np.arange(nbseeds)]).all()) - - def test_constrained_voronoi_2(self, nbseeds=3): - # Test the geodisc k-means algorithm - xyz, x = np.zeros((30, 3)), np.arange(30) - xyz[:, 0] = x - y = np.array((x // 10), np.float) - F = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 6), y) - seeds = np.array([1, 18, 25]) - label = F.constrained_voronoi(seeds) - assert_array_equal(label, x // 10) - - def test_subfield(self): - import numpy.random as nr - F = basic_field_random() - valid = nr.rand(F.V)>0.1 - sf = F.subfield(valid) - self.assert_(sf.V==np.sum(valid)) - - def test_subfield2(self): - F = basic_field_random() - valid = np.zeros(F.V) - sf = F.subfield(valid) - self.assert_(sf==None) - - def test_ward1(self): - F = basic_field_random() - Lab, J = F.ward(10) - self.assert_(Lab.max()==9) - - def test_ward2(self): - F = basic_field_random() - Lab, J1 = F.ward(5) - Lab, J2 = F.ward(10) - self.assert_(J1>J2) - - def test_field_from_coo_matrix(self): - import scipy.sparse as sps - V = 10 - a = np.random.rand(V, V)>.9 - fi = field_from_coo_matrix_and_data(sps.coo_matrix(a), a) - print fi.E , a.sum() - self.assert_(fi.E==a.sum()) + label[909], label[990], label[999]]).size == 9) + + +def test_watershed_2(): + myfield = basic_field_2() + myfield.field[555] = 10 + myfield.field[664] = 0 + idx, label = myfield.custom_watershed() + assert_true(np.size(idx) == 9) + + +def test_watershed_3(): + myfield = basic_field_2() + myfield.field[555] = 10 + myfield.field[664] = 0 + idx, label = myfield.custom_watershed(0,11) + assert_true(np.size(idx)==8) + + +def test_bifurcations_1(): + myfield = basic_field() + idx, parent,label = myfield.threshold_bifurcations() + assert_true(idx == 999) + assert_true(parent == 0) + + +def test_bifurcations_2(): + myfield = basic_field_2() + idx, parent, label = myfield.threshold_bifurcations() + assert_true(np.size(idx) == 15) + + + +def test_geodesic_kmeans(nbseeds=3): + # Test the geodisc k-means algorithm + myfield = basic_field_random(5, 5, 1) + seeds = np.argsort(nr.rand(myfield.V))[:nbseeds] + seeds, label, inertia = myfield.geodesic_kmeans(seeds) + assert_array_equal(label[seeds], np.arange(nbseeds)) + assert_true(np.array([i in np.unique(label) + for i in np.arange(nbseeds)]).all()) + + +def test_constrained_voronoi(nbseeds=3): + # Test the geodisc k-means algorithm + myfield = basic_field_random() + seeds = np.argsort(nr.rand(myfield.V))[:nbseeds] + label = myfield.constrained_voronoi(seeds) + assert_array_equal(label[seeds], np.arange(nbseeds)) + assert_true(np.array([i in np.unique(label) + for i in np.arange(nbseeds)]).all()) + + +def test_constrained_voronoi_2(nbseeds=3): + # Test the geodisc k-means algorithm + xyz, x = np.zeros((30, 3)), np.arange(30) + xyz[:, 0] = x + y = np.array((x // 10), np.float) + myfield = field_from_graph_and_data(wgraph_from_3d_grid(xyz, 6), y) + seeds = np.array([1, 18, 25]) + label = myfield.constrained_voronoi(seeds) + assert_array_equal(label, x // 10) + + +def test_subfield(): + myfield = basic_field_random() + valid = nr.rand(myfield.V) > 0.1 + sf = myfield.subfield(valid) + assert_equal(sf.V, np.sum(valid)) + + +def test_subfield2(): + myfield = basic_field_random() + valid = np.zeros(myfield.V) + sf = myfield.subfield(valid) + assert_true(sf == None) + + +def test_ward1(): + myfield = basic_field_random() + lab, J = myfield.ward(10) + assert_equal(lab.max(), 9) + + +def test_ward2(): + myfield = basic_field_random() + Lab, J1 = myfield.ward(5) + Lab, J2 = myfield.ward(10) + assert_true(J1 > J2) + + +def test_field_from_coo_matrix(): + import scipy.sparse as sps + V = 10 + a = np.random.rand(V, V) > .9 + fi = field_from_coo_matrix_and_data(sps.coo_matrix(a), a) + assert_equal(fi.E, a.sum()) + if __name__ == '__main__': import nose From e551704d1ba655371217f24476b1737144e059aa Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 6 Feb 2013 21:08:52 +0100 Subject: [PATCH 136/164] COSMIT: a pass on test_graph --- nipy/algorithms/graph/tests/test_graph.py | 886 +++++++++++----------- 1 file changed, 453 insertions(+), 433 deletions(-) diff --git a/nipy/algorithms/graph/tests/test_graph.py b/nipy/algorithms/graph/tests/test_graph.py index 57de98bbe3..39df0ef85a 100644 --- a/nipy/algorithms/graph/tests/test_graph.py +++ b/nipy/algorithms/graph/tests/test_graph.py @@ -2,476 +2,496 @@ import numpy as np import numpy.random as nr -from unittest import TestCase +from numpy.testing import(assert_array_equal, assert_array_almost_equal, + assert_almost_equal) +from nose.tools import assert_true, assert_equal from ..graph import (WeightedGraph, complete_graph, mst, knn, eps_nn, wgraph_from_adjacency, wgraph_from_coo_matrix, concatenate_graphs, wgraph_from_3d_grid) + def basicdata(): - x = np.array( [[-1.998,-2.024], [-0.117,-1.010], [1.099,-0.057], - [ 1.729,-0.252], [1.003,-0.021], [1.703,-0.739], - [-0.557,1.382],[-1.200,-0.446],[-0.331,-0.256], - [-0.800,-1.584]]) + x = np.array( [[- 1.998, - 2.024], [- 0.117, - 1.010], [1.099, - 0.057], + [ 1.729, - 0.252], [1.003, - 0.021], [1.703, - 0.739], + [- 0.557, 1.382],[- 1.200, - 0.446],[- 0.331, - 0.256], + [- 0.800, - 1.584]]) return x + def basic_graph(): l = np.linspace(0, 2 * np.pi, 20, endpoint=False) x = np.column_stack((np.cos(l), np.sin(l))) G = knn(x, 2) return G + def basic_graph_2(): l = np.linspace(0, 2 * np.pi, 20, endpoint=False) x = np.column_stack((np.cos(l), np.sin(l))) G = knn(x, 2) return G, x -class test_Graph(TestCase): + +def test_complete(): + v = 10 + G = complete_graph(v) + a = G.get_edges()[:, 0] + b = G.get_edges()[:, 1] + inds = np.indices((v, v)).reshape( (2, v * v) ) + assert_array_equal(inds, (a, b)) + + +def test_knn_1(): + x = basicdata() + G = knn(x, 1) + A = G.get_edges()[:, 0] + assert_equal(np.shape(A)[0], 14) + - def test_complete(self): - v = 10 - G = complete_graph(v) - a = G.get_edges()[:, 0] - b = G.get_edges()[:, 1] - inds = np.indices((v, v)).reshape( (2, v * v) ) - self.assert_( ( inds == (a, b) ).all() ) - - def test_knn_1(self): - x = basicdata() - G = knn(x, 1) - A = G.get_edges()[:,0] - OK = (np.shape(A)[0] == (14)) - self.assert_(OK) +def test_set_euclidian(): + G, x = basic_graph_2() + d = G.weights + G.set_euclidian(x / 10) + D = G.weights + assert_true(np.allclose(D, d / 10, 1e-7)) + + +def test_set_gaussian(): + G, x = basic_graph_2() + d = G.weights + G.set_gaussian(x, 1.0) + D = G.weights + assert_true(np.allclose(D, np.exp(- d * d / 2), 1e-7)) + + +def test_set_gaussian_2(): + G, x = basic_graph_2() + d = G.weights + G.set_gaussian(x) + D = G.weights + sigma = np.sum(d * d) / len(d) + assert_true(np.allclose(D, np.exp(-d * d / (2 * sigma)), 1e-7)) - def test_set_euclidian(self): - G,x = basic_graph_2() - d = G.weights - G.set_euclidian(x / 10) - D = G.weights - OK = np.allclose(D, d / 10, 1e-7) - self.assert_(OK) - - def test_set_gaussian(self): - G,x = basic_graph_2() - d = G.weights - G.set_gaussian(x, 1.0) - D = G.weights - OK = np.allclose(D, np.exp(- d * d / 2), 1e-7) - self.assert_(OK) - - def test_set_gaussian_2(self): - G,x = basic_graph_2() - d = G.weights - G.set_gaussian(x) - D = G.weights - sigma = sum(d * d) / len(d) - OK = np.allclose(D, np.exp(-d * d / (2 * sigma)), 1e-7) - self.assert_(OK) - - def test_eps_1(self): - x = basicdata() - G = eps_nn(x, 1.) - D = G.weights - OK = (np.size(D) == 16) - self.assert_(OK) - OK = (D < 1).all() - self.assert_(OK) - - def test_mst_1(self): - x = basicdata() - G = mst(x) - D = G.weights - OK = (np.size(D) == 18) - self.assert_(OK) - - def test_3d_grid(self): - """test the 6nn graph - """ - x0 = np.array([0, 0, 0]) - x1 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [-1, 0, 0], [0, -1, 0], - [0, 0, -1]]) - x2 = np.array([[1, 1, 0], [0, 1, 1], [1, 0, 1], [1, -1, 0], [0, 1, -1], - [1, 0, -1], [-1, 1, 0], [0, -1, 1], [-1, 0, 1], - [-1, -1, 0], [-1, 0, -1], [0, -1, -1]]) - x3 = np.array([[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], - [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]) - for x in x1: - xyz = np.vstack((x0, x)) - assert wgraph_from_3d_grid(xyz, 6).E == 2 - assert wgraph_from_3d_grid(xyz, 18).E == 2 - assert wgraph_from_3d_grid(xyz, 26).E == 2 + +def test_eps_1(): + x = basicdata() + G = eps_nn(x, 1.) + D = G.weights + assert_equal(np.size(D), 16) + assert_true((D < 1).all()) + + +def test_mst_1(): + x = basicdata() + G = mst(x) + D = G.weights + assert_equal(np.size(D), 18) + + +def test_3d_grid(): + """test the 6nn graph + """ + x0 = np.array([0, 0, 0]) + x1 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [-1, 0, 0], [0, -1, 0], + [0, 0, -1]]) + x2 = np.array([[1, 1, 0], [0, 1, 1], [1, 0, 1], [1, -1, 0], [0, 1, -1], + [1, 0, -1], [-1, 1, 0], [0, -1, 1], [-1, 0, 1], + [-1, -1, 0], [-1, 0, -1], [0, -1, -1]]) + x3 = np.array([[1, 1, 1], [1, 1, -1], [1, -1, 1], [1, -1, -1], + [-1, 1, 1], [-1, 1, -1], [-1, -1, 1], [-1, -1, -1]]) + for x in x1: + xyz = np.vstack((x0, x)) + assert_equal(wgraph_from_3d_grid(xyz, 6).E, 2) + assert_equal(wgraph_from_3d_grid(xyz, 18).E, 2) + assert_equal(wgraph_from_3d_grid(xyz, 26).E, 2) for x in x2: xyz = np.vstack((x0, x)) - assert wgraph_from_3d_grid(xyz, 6).E == 0 - assert wgraph_from_3d_grid(xyz, 18).E == 2 - assert wgraph_from_3d_grid(xyz, 26).E == 2 + assert_equal(wgraph_from_3d_grid(xyz, 6).E, 0) + assert_equal(wgraph_from_3d_grid(xyz, 18).E, 2) + assert_equal(wgraph_from_3d_grid(xyz, 26).E, 2) for x in x3: xyz = np.vstack((x0, x)) - assert wgraph_from_3d_grid(xyz, 6).E == 0 - assert wgraph_from_3d_grid(xyz, 18).E == 0 - assert wgraph_from_3d_grid(xyz, 26).E == 2 + assert_equal(wgraph_from_3d_grid(xyz, 6).E, 0) + assert_equal(wgraph_from_3d_grid(xyz, 18).E, 0) + assert_equal(wgraph_from_3d_grid(xyz, 26).E, 2) - def test_grid_3d_1(self): - """ Test the 6 nn graphs on 3d grid - """ - nx, ny, nz = 9, 6, 1 - xyz = np.mgrid[0:nx, 0:ny, 0:nz] - xyz = np.reshape(xyz, (3, nx * ny * nz)).T - G = wgraph_from_3d_grid(xyz, 6) - self.assert_(G.E == 186) +def test_grid_3d_1(): + """ Test the 6 nn graphs on 3d grid + """ + nx, ny, nz = 9, 6, 1 + xyz = np.mgrid[0:nx, 0:ny, 0:nz] + xyz = np.reshape(xyz, (3, nx * ny * nz)).T + G = wgraph_from_3d_grid(xyz, 6) + assert_equal(G.E, 186) + - def test_grid_3d_2(self): - """ Test the 18-nn graph on a 3d grid - """ - nx, ny, nz = 9, 6, 1 - xyz = np.mgrid[0:nx, 0:ny, 0:nz] - xyz = np.reshape(xyz,(3, nx * ny * nz)).T - G = wgraph_from_3d_grid(xyz, 18) - self.assert_(G.E == 346) - - def test_grid_3d_3(self): - """ Test the 26-nn graph on a 3d grid - """ - nx, ny, nz = 9, 6, 1 - xyz = np.mgrid[0:nx, 0:ny, 0:nz] - xyz = np.reshape(xyz,(3, nx * ny * nz)).T - G = wgraph_from_3d_grid(xyz, 26) - self.assert_(G.E == 346) - - def test_grid_3d_4(self): - nx, ny, nz = 10, 10, 10 - xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T - G = wgraph_from_3d_grid(xyz, 26) - D = G.weights - # 6 * 9 * 10 * 10 - self.assert_(sum(D == 1)==5400 ) - # 26 * 8 ** 3 + 6 * 8 ** 2 * 17 + 12 * 8 * 11 + 8 * 7 - self.assert_(np.size(D) == 20952 ) - # 18 * 8 ** 3 + 6 * 8 ** 2 * 13 + 12 * 8 * 9 + 8 * 6 - self.assert_(sum(D < 1.5) == 15120) - - def test_grid_3d_5(self): - nx, ny, nz = 5, 5, 5 - xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T - G = wgraph_from_3d_grid(xyz, 26) - D = G.weights.copy() - G.set_euclidian(xyz) - assert (np.allclose(G.weights, D, 1.e-7)) - - def test_grid_3d_6(self): - nx, ny, nz = 5, 5, 5 - xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T - adj = wgraph_from_3d_grid(xyz, 26).to_coo_matrix().tolil() - assert len(adj.rows[63]) == 26 - for i in [62, 64, 58, 68, 38, 88, 57, 67, 37, 87, 59, 69, 39, 89, 33, - 83, 43, 93, 32, 82, 42, 92, 34, 84, 44, 94]: - assert i in adj.rows[63] - - def test_grid_3d_7(self): - """ Check that the grid graph is symmetric - """ - xyz = np.array(np.where(np.random.rand(5, 5, 5) > 0.5)).T - adj = wgraph_from_3d_grid(xyz, 6).to_coo_matrix() - assert (adj - adj.T).nnz == 0 - adj = wgraph_from_3d_grid(xyz, 18).to_coo_matrix() - assert (adj - adj.T).nnz == 0 - adj = wgraph_from_3d_grid(xyz, 26).to_coo_matrix() - assert (adj - adj.T).nnz == 0 +def test_grid_3d_2(): + """ Test the 18-nn graph on a 3d grid + """ + nx, ny, nz = 9, 6, 1 + xyz = np.mgrid[0:nx, 0:ny, 0:nz] + xyz = np.reshape(xyz,(3, nx * ny * nz)).T + G = wgraph_from_3d_grid(xyz, 18) + assert_equal(G.E, 346) - def test_cut_redundancies(self): - G = basic_graph() - e = G.E - edges = G.get_edges() - weights = G.weights - G.E = 2 * G.E - G.edges = np.concatenate((edges, edges)) - G.weights = np.concatenate((weights, weights)) - K = G.cut_redundancies() - OK = (K.E == e) - self.assert_(OK) - - def test_degrees(self): - G = basic_graph() - (r,l) = G.degrees() - self.assert_(( r == 2 ).all()) - self.assert_(( l == 2 ).all()) - - def test_normalize(self): - G = basic_graph() - G.normalize() - M = G.to_coo_matrix() - sM = np.array(M.sum(1)).ravel() - test = np.absolute(sM - 1) < 1.e-7 - OK = np.size(np.nonzero(test) == 0) - self.assert_(OK) - - def test_normalize_2(self): - G = basic_graph() - G.normalize(0) - M = G.to_coo_matrix() - sM = np.array(M.sum(1)).ravel() - test = np.absolute(sM - 1) < 1.e-7 - OK = np.size(np.nonzero(test)==0) - self.assert_(OK) - - def test_normalize_3(self): - G = basic_graph() - G.normalize(1) - M = G.to_coo_matrix() - sM = np.array(M.sum(0)).ravel() - test = np.absolute(sM - 1) < 1.e-7 - OK = np.size(np.nonzero(test)==0) - self.assert_(OK) - - def test_adjacency(self): - G = basic_graph() - M = G.to_coo_matrix() - self.assert_(( M.diagonal() == 0 ).all()) - A = M.toarray() - self.assert_(( np.diag(A, 1) != 0 ).all()) - self.assert_(( np.diag(A, -1) != 0 ).all()) - - def test_cc(self): - G = basic_graph() - l = G.cc() - L = np.array(l==0) - OK = L.all() - self.assert_(OK) - - def test_isconnected(self): - G = basic_graph() - self.assert_(G.is_connected()) - - def test_main_cc(self): - x = basicdata() - G = knn(x, 1) - l = G.cc() - l = G.main_cc() - assert np.size(l)==6 - - def test_dijkstra(self): - """ Test dijkstra's algorithm - """ - G = basic_graph() - l = G.dijkstra(0) - assert (np.absolute(l[10] - 20 * np.sin(np.pi / 20)) < 1.e-7) - - def test_dijkstra_multiseed(self): - """ Test dijkstra's algorithm, multi_seed version - """ - G = basic_graph() - l = G.dijkstra([0, 1]) - assert (np.absolute(l[10] - 18 * np.sin(np.pi / 20)) < 1.e-7) - - - def test_dijkstra2(self): - """ Test dijkstra's algorithm, API detail - """ - G = basic_graph() - l = G.dijkstra() - assert (np.absolute(l[10] - 20 * np.sin(np.pi / 20)) < 1.e-7) +def test_grid_3d_3(): + """ Test the 26-nn graph on a 3d grid + """ + nx, ny, nz = 9, 6, 1 + xyz = np.mgrid[0:nx, 0:ny, 0:nz] + xyz = np.reshape(xyz,(3, nx * ny * nz)).T + G = wgraph_from_3d_grid(xyz, 26) + assert_equal(G.E, 346) + + +def test_grid_3d_4(): + nx, ny, nz = 10, 10, 10 + xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T + G = wgraph_from_3d_grid(xyz, 26) + D = G.weights + # 6 * 9 * 10 * 10 + assert_equal(sum(D == 1), 5400 ) + # 26 * 8 ** 3 + 6 * 8 ** 2 * 17 + 12 * 8 * 11 + 8 * 7 + assert_equal(np.size(D), 20952 ) + # 18 * 8 ** 3 + 6 * 8 ** 2 * 13 + 12 * 8 * 9 + 8 * 6 + assert_equal(sum(D < 1.5), 15120) + + +def test_grid_3d_5(): + nx, ny, nz = 5, 5, 5 + xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T + G = wgraph_from_3d_grid(xyz, 26) + D = G.weights.copy() + G.set_euclidian(xyz) + assert_array_almost_equal(G.weights, D) + + +def test_grid_3d_6(): + nx, ny, nz = 5, 5, 5 + xyz = np.reshape(np.indices((nx, ny, nz)), (3, nx * ny * nz)).T + adj = wgraph_from_3d_grid(xyz, 26).to_coo_matrix().tolil() + assert_equal(len(adj.rows[63]), 26) + for i in [62, 64, 58, 68, 38, 88, 57, 67, 37, 87, 59, 69, 39, 89, 33, + 83, 43, 93, 32, 82, 42, 92, 34, 84, 44, 94]: + assert_true(i in adj.rows[63]) + + +def test_grid_3d_7(): + """ Check that the grid graph is symmetric + """ + xyz = np.array(np.where(np.random.rand(5, 5, 5) > 0.5)).T + adj = wgraph_from_3d_grid(xyz, 6).to_coo_matrix() + assert_equal((adj - adj.T).nnz, 0) + adj = wgraph_from_3d_grid(xyz, 18).to_coo_matrix() + assert_equal((adj - adj.T).nnz, 0) + adj = wgraph_from_3d_grid(xyz, 26).to_coo_matrix() + assert_equal((adj - adj.T).nnz, 0) - def test_compact_representation(self): - """ Test that the compact representation of the graph is indeed correct - """ - G = basic_graph() - idx, ne, we = G.compact_neighb() - assert len(idx) == 21 - assert idx[0] == 0 - assert idx[20] == G.E - assert len(ne) == G.E - assert len(we) == G.E - - def test_floyd_1(self): - """ Test Floyd's algo without seed - """ - G = basic_graph() - l = G.floyd() - for i in range(10): - plop = np.absolute(np.diag(l, i) - 2 * i * np.sin(2 * np.pi / 40)) - assert(plop.max()<1.e-4) - - def test_floyd_2(self): - """ Test Floyd's algo, with seed - """ - G = basic_graph() - seeds = np.array([0,10]) - l = G.floyd(seeds) + +def test_cut_redundancies(): + G = basic_graph() + e = G.E + edges = G.get_edges() + weights = G.weights + G.E = 2 * G.E + G.edges = np.concatenate((edges, edges)) + G.weights = np.concatenate((weights, weights)) + K = G.cut_redundancies() + assert_equal(K.E, e) + + +def test_degrees(): + G = basic_graph() + (r, l) = G.degrees() + assert_true((r == 2).all()) + assert_true((l == 2).all()) + + +def test_normalize(): + G = basic_graph() + G.normalize() + M = G.to_coo_matrix() + sM = np.array(M.sum(1)).ravel() + assert_true((np.abs(sM - 1) < 1.e-7).all()) + + +def test_normalize_2(): + G = basic_graph() + G.normalize(0) + M = G.to_coo_matrix() + sM = np.array(M.sum(1)).ravel() + assert_true((np.abs(sM - 1) < 1.e-7).all()) + + +def test_normalize_3(): + G = basic_graph() + G.normalize(1) + M = G.to_coo_matrix() + sM = np.array(M.sum(0)).ravel() + assert_true((np.abs(sM - 1) < 1.e-7).all()) + + +def test_adjacency(): + G = basic_graph() + M = G.to_coo_matrix() + assert_true(( M.diagonal() == 0 ).all()) + A = M.toarray() + assert_true(( np.diag(A, 1) != 0 ).all()) + assert_true(( np.diag(A, -1) != 0 ).all()) + + +def test_cc(): + G = basic_graph() + l = G.cc() + L = np.array(l==0) + assert_true(L.all()) + + +def test_isconnected(): + G = basic_graph() + assert_true(G.is_connected()) + + +def test_main_cc(): + x = basicdata() + G = knn(x, 1) + l = G.cc() + l = G.main_cc() + assert_equal(np.size(l), 6) + +def test_dijkstra(): + """ Test dijkstra's algorithm + """ + G = basic_graph() + l = G.dijkstra(0) + assert_true(np.abs(l[10] - 20 * np.sin(np.pi / 20)) < 1.e-7) + +def test_dijkstra_multiseed(): + """ Test dijkstra's algorithm, multi_seed version + """ + G = basic_graph() + l = G.dijkstra([0, 1]) + assert_true(np.abs(l[10] - 18 * np.sin(np.pi / 20)) < 1.e-7) + + +def test_dijkstra2(): + """ Test dijkstra's algorithm, API detail + """ + G = basic_graph() + l = G.dijkstra() + assert_true(np.abs(l[10] - 20 * np.sin(np.pi / 20)) < 1.e-7) + + +def test_compact_representation(): + """ Test that the compact representation of the graph is indeed correct + """ + G = basic_graph() + idx, ne, we = G.compact_neighb() + assert_equal(len(idx), 21) + assert_equal(idx[0], 0) + assert_equal(idx[20], G.E) + assert_equal(len(ne), G.E) + assert_equal(len(we), G.E) + + +def test_floyd_1(): + """ Test Floyd's algo without seed + """ + G = basic_graph() + l = G.floyd() + for i in range(10): + plop = np.abs(np.diag(l, i) - 2 * i * np.sin(2 * np.pi / 40)) + assert_true(plop.max() < 1.e-4) - for i in range(10): - plop = np.absolute(l[0,i]-2*i*np.sin(2*np.pi/40)) - assert (plop.max()<1.e-4) - plop = np.absolute(l[0,19-i]-2*(i+1)*np.sin(2*np.pi/40)) - assert (plop.max()<1.e-4) - - for i in range(10): - plop = np.absolute(l[1,i]-2*(10-i)*np.sin(2*np.pi/40)) - assert (plop.max()<1.e-4) - plop = np.absolute(l[1,19-i]-2*(9-i)*np.sin(2*np.pi/40)) - assert (plop.max()<1.e-4) +def test_floyd_2(): + """ Test Floyd's algo, with seed + """ + G = basic_graph() + seeds = np.array([0,10]) + l = G.floyd(seeds) + + for i in range(10): + plop = np.abs(l[0, i] - 2 * i * np.sin(2 * np.pi / 40)) + assert_true(plop.max() < 1.e-4) + plop = np.abs(l[0,19 - i] - 2 * (i + 1) * np.sin(2 * np.pi / 40)) + assert_true(plop.max() < 1.e-4) + + for i in range(10): + plop = np.abs(l[1, i] - 2 * (10 - i) * np.sin(2 * np.pi / 40)) + assert_true(plop.max() < 1.e-4) + plop = np.abs(l[1, 19 - i] - 2 * (9 - i) * np.sin(2 * np.pi / 40)) + assert_true(plop.max() < 1.e-4) - def test_symmeterize(self): - a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) - b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) - edges = np.vstack((a, b)).T - d = np.ones(14) - G = WeightedGraph(7, edges, d) - G.symmeterize() - d = G.weights - ok = (d == 0.5) - self.assert_(ok.all()) - - def test_voronoi(self): - """ test voronoi labelling with 2 seeds - """ - a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) - b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) - d = np.array([1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]); - edges = np.transpose(np.vstack((a, b))) - G = WeightedGraph(7, edges,d) - G.symmeterize() - seed = np.array([0, 6]) - label = G.voronoi_labelling(seed) - assert(label[1] == 0) - - def test_voronoi2(self): - """ test voronoi labelling with one seed - """ - a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) - b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) - d = np.array([1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]); - edges = np.vstack((a, b)).T - G = WeightedGraph(7, edges,d) - G.symmeterize() - seed = np.array([0]) - label = G.voronoi_labelling(seed) - assert(label[4] == 0) - - def test_voronoi3(self): - """ test voronoi labelling with non-connected components - """ - a = np.array([0, 1, 2, 5, 6]) - b = np.array([1, 2, 3, 6, 0]) - d = np.array([1, 1, 1, 1, 1]); - edges = np.vstack((a, b)).T - G = WeightedGraph(7, edges,d) - G.symmeterize() - seed = np.array([0]) - label = G.voronoi_labelling(seed) - assert(label[4] == - 1) - - def test_concatenate1(self,n=10,verbose=0): - x1 = nr.randn(n,2) - x2 = nr.randn(n,2) - G1 = knn(x1, 5) - G2 = knn(x2, 5) - G = concatenate_graphs(G1, G2) - if verbose: - G.plot(np.hstack((x1, x2))) - self.assert_(G.cc().max()>0) - - def test_concatenate2(self,n=10,verbose=0): - G1 = complete_graph(n) - G2 = complete_graph(n) - G = concatenate_graphs(G1, G2) - self.assert_(G.cc().max() == 1) - - def test_anti_symmeterize(self,verbose=0): - n = 10 - eps = 1.e-7 - M = (nr.rand(n, n) > 0.7).astype(np.float) - C = M - M.T - G = wgraph_from_adjacency(M) - G.anti_symmeterize() - A = G.to_coo_matrix() - self.assert_(np.sum(C - A) ** 2 < eps) - - def test_subgraph_1(self,n=10,verbose=0): - x = nr.randn(n, 2) - G = WeightedGraph(x.shape[0]) - valid = np.zeros(n) - g = G.subgraph(valid) - self.assert_(g is None) - - def test_subgraph_2(self,n=10,verbose=0): - x = nr.randn(n,2) - G = knn(x, 5) - valid = np.zeros(n) - valid[:n/2] = 1 - g = G.subgraph(valid) - self.assert_(g.edges.max() < n / 2) - - def test_graph_create_from_array(self): - """ - Test the creation of a graph from a sparse coo_matrix - """ - a = np.random.randn(5, 5) - wg = wgraph_from_adjacency(a) - b = wg.to_coo_matrix() - self.assert_((a == b.todense()).all()) - - def test_graph_create_from_coo_matrix(self): - """ - Test the creation of a graph from a sparse coo_matrix - """ - import scipy.sparse as spp - a = (np.random.randn(5, 5) > .8).astype(np.float) - s = spp.coo_matrix(a) - wg = wgraph_from_coo_matrix(s) - b = wg.to_coo_matrix() - self.assert_((b.todense() == a).all()) - - def test_to_coo_matrix(self): - """ Test the generation of a sparse matrix as output - """ - a = (np.random.randn(5, 5)>.8).astype(np.float) - wg = wgraph_from_adjacency(a) - b = wg.to_coo_matrix().todense() - self.assert_((a==b).all()) +def test_symmeterize(): + a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) + b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) + edges = np.vstack((a, b)).T + d = np.ones(14) + G = WeightedGraph(7, edges, d) + G.symmeterize() + d = G.weights + assert_true((d == 0.5).all()) + + +def test_voronoi(): + """ test voronoi labelling with 2 seeds + """ + a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) + b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) + d = np.array([1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]); + edges = np.transpose(np.vstack((a, b))) + G = WeightedGraph(7, edges,d) + G.symmeterize() + seed = np.array([0, 6]) + label = G.voronoi_labelling(seed) + assert_equal(label[1], 0) - def test_list_neighbours(self): - """ test the generation of neighbours list - """ - bg = basic_graph() - nl = bg.list_of_neighbors() - assert(len(nl) == bg.V) - for ni in nl: - assert len(ni)== 2 - def test_kruskal(self): - """ test Kruskal's algor to thin the graph - """ - x = basicdata() - dmax = np.sqrt((x ** 2).sum()) - m = mst(x) - g = eps_nn(x, dmax) - k = g.kruskal() - assert np.abs(k.weights.sum() - m.weights.sum() < 1.e-7) - - def test_concatenate3(self): - """ test the graph concatenation utlitity - """ - bg = basic_graph() - cg = concatenate_graphs(bg, bg) - valid = np.zeros(cg.V) - valid[:bg.V] = 1 - sg = cg.subgraph(valid) - assert (sg.edges == bg.edges).all() - assert (sg.weights == bg.weights).all() - - def test_cliques(self): - """ test the computation of cliques - """ - x = np.random.rand(20, 2) - x[15:] += 2. - g = knn(x, 5) - g.set_gaussian(x, 1.) - cliques = g.cliques() - assert len(np.unique(cliques)) > 1 +def test_voronoi2(): + """ test voronoi labelling with one seed + """ + a = np.array([0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6]) + b = np.array([1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 0, 0, 1]) + d = np.array([1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2]); + edges = np.vstack((a, b)).T + G = WeightedGraph(7, edges,d) + G.symmeterize() + seed = np.array([0]) + label = G.voronoi_labelling(seed) + assert_equal(label[4], 0) + + +def test_voronoi3(): + """ test voronoi labelling with non-connected components + """ + a = np.array([0, 1, 2, 5, 6]) + b = np.array([1, 2, 3, 6, 0]) + d = np.array([1, 1, 1, 1, 1]); + edges = np.vstack((a, b)).T + G = WeightedGraph(7, edges,d) + G.symmeterize() + seed = np.array([0]) + label = G.voronoi_labelling(seed) + assert_equal(label[4], - 1) + +def test_concatenate1(n=10): + x1 = nr.randn(n, 2) + x2 = nr.randn(n, 2) + G1 = knn(x1, 5) + G2 = knn(x2, 5) + G = concatenate_graphs(G1, G2) + assert_true(G.cc().max() > 0) + + +def test_concatenate2(n=10): + G1 = complete_graph(n) + G2 = complete_graph(n) + G = concatenate_graphs(G1, G2) + assert_true(G.cc().max() == 1) + + +def test_anti_symmeterize(): + n = 10 + eps = 1.e-7 + M = (nr.rand(n, n) > 0.7).astype(np.float) + C = M - M.T + G = wgraph_from_adjacency(M) + G.anti_symmeterize() + A = G.to_coo_matrix() + assert_true(np.sum(C - A) ** 2 < eps) + + +def test_subgraph_1(n=10): + x = nr.randn(n, 2) + G = WeightedGraph(x.shape[0]) + valid = np.zeros(n) + assert(G.subgraph(valid) is None) + + +def test_subgraph_2(n=10): + x = nr.randn(n, 2) + G = knn(x, 5) + valid = np.zeros(n) + valid[:n / 2] = 1 + assert_true(G.subgraph(valid).edges.max() < n / 2) + + +def test_graph_create_from_array(): + """Test the creation of a graph from a sparse coo_matrix + """ + a = np.random.randn(5, 5) + wg = wgraph_from_adjacency(a) + b = wg.to_coo_matrix() + assert_array_equal(a, b.todense()) + + +def test_graph_create_from_coo_matrix(): + """Test the creation of a graph from a sparse coo_matrix + """ + import scipy.sparse as spp + a = (np.random.randn(5, 5) > .8).astype(np.float) + s = spp.coo_matrix(a) + wg = wgraph_from_coo_matrix(s) + b = wg.to_coo_matrix() + assert_array_equal(b.todense(), a) + + +def test_to_coo_matrix(): + """ Test the generation of a sparse matrix as output + """ + a = (np.random.randn(5, 5)>.8).astype(np.float) + wg = wgraph_from_adjacency(a) + b = wg.to_coo_matrix().todense() + assert_array_equal(a, b) + + +def test_list_neighbours(): + """ test the generation of neighbours list + """ + bg = basic_graph() + nl = bg.list_of_neighbors() + assert_equal(len(nl), bg.V) + for ni in nl: + assert_equal(len(ni), 2) + + +def test_kruskal(): + """ test Kruskal's algor to thin the graph + """ + x = basicdata() + dmax = np.sqrt((x ** 2).sum()) + m = mst(x) + g = eps_nn(x, dmax) + k = g.kruskal() + assert_almost_equal(k.weights.sum(), m.weights.sum()) + + +def test_concatenate3(): + """ test the graph concatenation utlitity + """ + bg = basic_graph() + cg = concatenate_graphs(bg, bg) + valid = np.zeros(cg.V) + valid[:bg.V] = 1 + sg = cg.subgraph(valid) + assert_array_equal(sg.edges, bg.edges) + assert_array_equal(sg.weights, bg.weights) + + +def test_cliques(): + """ test the computation of cliques + """ + x = np.random.rand(20, 2) + x[15:] += 2. + g = knn(x, 5) + g.set_gaussian(x, 1.) + cliques = g.cliques() + assert_true(len(np.unique(cliques)) > 1) + if __name__ == '__main__': import nose From 479f2d740cadc17ae8c08153b4b1628ef52214fc Mon Sep 17 00:00:00 2001 From: bthirion Date: Thu, 7 Feb 2013 14:56:39 +0100 Subject: [PATCH 137/164] ENH: Avoid the systematic casting to np.float64 in dilation function --- nipy/algorithms/graph/field.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/nipy/algorithms/graph/field.py b/nipy/algorithms/graph/field.py index 3c140fe671..665a0f1d8d 100644 --- a/nipy/algorithms/graph/field.py +++ b/nipy/algorithms/graph/field.py @@ -149,8 +149,7 @@ def opening(self, nbiter=1): self.dilation(nbiter) def dilation(self, nbiter=1, fast=True): - """ - Morphological dimlation of the field data. self.field is changed + """Morphological dilation of the field data, changed in place Parameters ---------- @@ -161,11 +160,11 @@ def dilation(self, nbiter=1, fast=True): A conversion to np.float64 is performed automatically """ nbiter = int(nbiter) + if self.field.dtype != np.float64: + warn('data type is not float64; a slower version is used') + fast = False if fast: from ._graph import dilation - if self.field.dtype != np.float64: - warn('A conversion to float64 has been performed') - self.field = self.field.astype(np.float64) if self.E > 0: if (self.field.size == self.V): self.field = self.field.reshape((self.V, 1)) @@ -181,16 +180,17 @@ def dilation(self, nbiter=1, fast=True): self.field = np.array([self.field[row].max(0) for row in rows]) def highest_neighbor(self, refdim=0): - """ Computes the neighbor with highest field value along refdim + """Computes the neighbor with highest field value along refdim Parameters ---------- - refdim: int optiontal, the dimension to consider + refdim: int, optional, + the dimension of the field under consideration Returns ------- - hneighb: array of shape(self.V), index of the neighbor with highest - value + hneighb: array of shape(self.V), + index of the neighbor with highest value """ from scipy.sparse import dia_matrix refdim = int(refdim) From 0523deb8607bb58041fd7aee3351feb38f99f6a5 Mon Sep 17 00:00:00 2001 From: bthirion Date: Mon, 11 Feb 2013 14:15:21 +0100 Subject: [PATCH 138/164] ENH: update docstring and remove one copy --- nipy/algorithms/graph/field.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nipy/algorithms/graph/field.py b/nipy/algorithms/graph/field.py index 665a0f1d8d..04dc79b403 100644 --- a/nipy/algorithms/graph/field.py +++ b/nipy/algorithms/graph/field.py @@ -155,9 +155,9 @@ def dilation(self, nbiter=1, fast=True): ---------- nbiter: int, optional, the number of iterations required - Caveat - ------ - A conversion to np.float64 is performed automatically + Note + ---- + When data dtype is not float64, a slow version of the code is used """ nbiter = int(nbiter) if self.field.dtype != np.float64: @@ -266,8 +266,8 @@ def local_maxima(self, refdim=0, th=NEGINF): # create a subfield(thresholding) sf = self.subfield(self.field.T[refdim] >= th) - initial_field = sf.field.T[refdim].astype(np.float64) - sf.field = initial_field.copy() + initial_field = sf.field.T[refdim] + sf.field = initial_field.astype(np.float64) # compute the depth in the subgraph ldepth = sf.V * np.ones(sf.V, np.int) From 37530803b8a97f64c2a5f78df9f5a931403cad6f Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 26 Sep 2012 19:55:54 +0200 Subject: [PATCH 139/164] BF Fixed the case of empty set of regions in bsa -- to be further checked --- .../bayesian_structural_analysis.py | 34 +++++++++++-------- nipy/labs/spatial_models/bsa_io.py | 2 +- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 34114f10d9..77839131ae 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -405,21 +405,25 @@ def bsa_dpmm2(bf, gf0, sub, gfc, dmax, thq, ths, verbose): for s in range(n_subj): bfs = bf[s] if bfs is not None: - leaves = np.asarray( - [bfs.select_id(id) for id in bfs.get_leaves_id()]) - us = - np.ones(bfs.k).astype(np.int) - lq = np.zeros(bfs.k) - lq[leaves] = q[sub == s] - bfs.set_roi_feature('posterior_proba', lq) - lq = np.zeros(bfs.k) - lq[leaves] = 1 - gf0[sub == s] - bfs.set_roi_feature('prior_proba', lq) - us[leaves] = u[sub == s] - - # when parent regions has similarly labelled children, - # include it also - us = bfs.make_forest().propagate_upward(us) - bfs.set_roi_feature('label', us) + if bfs.k > 0: + leaves = np.asarray( + [bfs.select_id(id) for id in bfs.get_leaves_id()]) + us = - np.ones(bfs.k).astype(np.int) + lq = np.zeros(bfs.k) + lq[leaves] = q[sub == s] + bfs.set_roi_feature('posterior_proba', lq) + lq = np.zeros(bfs.k) + lq[leaves] = 1 - gf0[sub == s] + bfs.set_roi_feature('prior_proba', lq) + us[leaves] = u[sub == s] + + # when parent regions has similarly labelled children, + # include it also + us = bfs.make_forest().propagate_upward(us) + bfs.set_roi_feature('label', us) + else: + bfs.set_roi_feature('label', np.array([])) + bf[s] = bfs # derive the group-level landmarks # with a threshold on the number of subjects diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 2cf0ff2281..8dad2408f8 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -170,7 +170,7 @@ def make_bsa_image( labels = - 2 * np.ones(ref_dim) labels[mask > 0] = -1 if BF[s] is not None: - nls = BF[s].get_roi_feature('label') + nls = BF[s].get_roi_feature('label').astype(np.int) nls[nls == - 1] = default_idx lab = BF[s].label lab[lab > - 1] = nls[lab[lab > - 1]] From 44727da8491207f608731cc16b4ca0fc4e602990 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 26 Mar 2013 00:36:31 +0100 Subject: [PATCH 140/164] A pass on bsa module: simplifications, redundancy removal, more explicit variable naming --- .../bayesian_structural_analysis.py | 620 +++++++----------- nipy/labs/spatial_models/bsa_io.py | 25 +- nipy/labs/spatial_models/tests/test_bsa.py | 5 +- 3 files changed, 257 insertions(+), 393 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 77839131ae..59fd9d30d7 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -12,7 +12,7 @@ Accurate Definition of Brain Regions Position Through the Functional Landmark Approach, MICCAI 2010 -Author : Bertrand Thirion, 2006-2011 +Author : Bertrand Thirion, 2006-2013 """ import numpy as np @@ -29,31 +29,35 @@ #################################################################### -def _relabel_(label, nl=None): - """ Simple utilisity to relabel a pre-existing label vector +def _relabel(label, new_values=None): + """ Utility to relabel a pre-existing label vector + to the values provided in new_values. Parameters ---------- - label: array of shape(n) - nl: array of shape(p), where p<= label.max(), optional - if None, the output is -1*np.ones(n) + label: array of shape(n), + the inut labels + new_values: array of shape(p), where p<= label.max(), optional + if None, the output is -1 * np.ones(n) + the new values to be given to the labels Returns ------- - new_label : array of shape (n) + new_label: array of shape (n) """ - if label.max() + 1 < np.size(nl): - raise ValueError('incompatible values for label of nl') - new_label = - np.ones(np.shape(label)) - if nl is not None: + if label.max() + 1 < np.size(new_values): + raise ValueError('incompatible values for label of new_values') + new_label = - np.ones_like(label) + if new_values is not None: aux = np.arange(label.max() + 1) - aux[0: np.size(nl)] = nl + aux[0: np.size(new_values)] = new_values new_label[label > - 1] = aux[label[label > - 1]] return new_label -def signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): - """Convert a set of z-values to posterior probabilities of not being active +def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): + """Convert a set of statistics to posterior probabilities of being + generated under H0 Parameters ---------- @@ -61,418 +65,396 @@ def signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): data that is assessed learn: array pf shape(n_samples), optional data to learn a mixture model - method: string, optional, to be chosen within - ['gauss_mixture', 'emp_null', 'gam_gauss', 'prior'] - alpha: float in the [0,1], optional, + defaults to learn + method: string, one of ['gauss_mixture', 'emp_null', 'gam_gauss', 'prior'] + optional + 'gauss_mixture' A Gaussian Mixture Model is used + 'emp_null' a null mode is fitted to test + 'gam_gauss' a Gamma-Gaussian mixture is used + 'prior' a hard-coded function is used + alpha: float in the [0,1] range, optional, parameter that yields the prior probability that a region is active should be chosen close to 0 + + Returns + ------- + posterior_null: array of shape(n_samples) + an estimation of the probability that the observation + is generated under the null """ if method == 'gauss_mixture': prior_strength = 100 fixed_scale = True - bfp = three_classes_GMM_fit( + posterior_probas = three_classes_GMM_fit( learn, test, alpha, prior_strength, verbose, fixed_scale) - bf0 = bfp[:, 1] + posterior_null = posterior_probas[:, 1] elif method == 'emp_null': enn = NormalEmpiricalNull(learn) enn.learn() - bf0 = np.reshape(enn.fdr(test), np.size(test)) + posterior_null = np.reshape(enn.fdr(test), np.size(test)) elif method == 'gam_gauss': - bfp = gamma_gaussian_fit(learn, test, verbose) - bf0 = bfp[:, 1] + posterior_probas = gamma_gaussian_fit(learn, test, verbose) + posterior_null = posterior_probas[:, 1] elif method == 'prior': y0 = st.norm.pdf(test) shape_, scale_ = 3., 2. y1 = st.gamma.pdf(test, shape_, scale=scale_) - bf0 = np.ravel((1 - alpha) * y0 / (alpha * y1 + (1 - alpha) * y0)) + posterior_null = np.ravel( + (1 - alpha) * y0 / (alpha * y1 + (1 - alpha) * y0)) else: raise ValueError('Unknown method') - return bf0 + return posterior_null -def compute_individual_regions(domain, lbeta, smin=5, theta=3.0, - method='gauss_mixture', verbose=0, reshuffle=0, - criterion='size', assign_val='weighted_mean'): +def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, + method='gauss_mixture', verbose=0): """ Compute the individual regions that are real activation candidates Parameters ---------- - dom : StructuredDomain instance, + domain : StructuredDomain instance, generic descriptor of the space domain - lbeta: an array of shape (nbnodes, subjects) + stats: an array of shape (n_voxels, n_subjects) the multi-subject statistical maps + threshold: float, optional + first level threshold smin: int, optional minimal size of the regions to validate them - theta: float, optional - first level threshold - method: string, optional, - method that is used to provide priori significance - can be 'prior', 'gauss_mixture', 'gam_gauss' or 'emp_null' + method: string, one of ['prior', 'gauss_mixture', 'gam_gauss', 'emp_null'] + optional, + method that is used to estimate prior significance verbose: verbosity mode, optional - reshuffle: bool, otpional, - if nonzero, reshuffle the positions; this affects bf and gfc - criterion: string, optional, - 'size' or 'volume', thresholdding criterion - assign_val: string, optional, - to be chosen in 'weighted mean', 'mean', 'min', 'max' - heuristic to assigna blob-level signal Returns ------- - bf list of nipy.labs.spatial_models.hroi.Nroi instances - representing individual ROIs - let nr be the number of terminal regions across subjects - gf0, array of shape (nr) + hrois: list of nipy.labs.spatial_models.hroi.HierrachicalROI instances + that represent individual ROIs + let nr be the number of terminal regions across subjects + prior_h0, array of shape (nr) the mixture-based prior probability that the terminal regions are false positives - sub, array of shape (nr) + subjects, array of shape (nr) the subject index associated with the terminal regions - gfc, array of shape (nr, coord.shape[1]) + coords, array of shape (nr, coord.shape[1]) the coordinates of the of the terminal regions Fixme ----- Should allow for subject specific domains """ - bf = [] - gfc = [] - gf0 = [] - sub = [] - n_subj = lbeta.shape[1] - nvox = lbeta.shape[0] - - for s in range(n_subj): + hrois = [] + coords = [] + prior_h0 = [] + subjects = [] + n_subjects = stats.shape[1] + nvox = stats.shape[0] + + for subject in range(n_subjects): # description in terms of blobs - beta = np.reshape(lbeta[:, s], (nvox, 1)) - nroi = HROI_as_discrete_domain_blobs( - domain, beta, threshold=theta, smin=smin) + stats_ = np.reshape(stats[:, subject], (nvox, 1)) + hroi = HROI_as_discrete_domain_blobs( + domain, stats_, threshold=threshold, smin=smin) - if nroi is not None and nroi.k > 0: - bfm = nroi.representative_feature('signal', 'weighted mean') - bfm = bfm[[nroi.select_id(id) for id in nroi.get_leaves_id()]] + if hroi is not None and hroi.k > 0: + # get the leave regions (i.e. the local maxima) + leaves = [hroi.select_id(id) for id in hroi.get_leaves_id()] + + # get the region mean statistical value + mean_val = hroi.representative_feature('signal', 'weighted mean') + mean_val = mean_val[leaves] + # get the regions position - if reshuffle: - nroi.reduce_to_leaves() - ## randomize the positions - ## by taking any local maximum of the image - temp = np.argsort(np.random.rand(nvox))[:nroi.k] - bfc = domain.coord[temp] - else: - mean_pos = np.asarray( - [np.mean(coords, 0) for coords in nroi.get_coord()]) - nroi.set_roi_feature('position', mean_pos) - bfc = mean_pos[[nroi.select_id(id) - for id in nroi.get_leaves_id()]] - gfc.append(bfc) + mean_pos = np.asarray( + [np.mean(coord, 0) for coord in hroi.get_coord()]) + hroi.set_roi_feature('position', mean_pos) + coords.append(mean_pos[leaves]) # compute the prior proba of being null - learn = np.squeeze(beta[beta != 0]) - bf0 = signal_to_pproba(bfm, learn, method) - gf0.append(bf0) - sub.append(s * np.ones(np.size(bfm))) + learning_set = np.squeeze(stats_[stats_ != 0]) + prior_h0.append(_signal_to_pproba(mean_val, learning_set, method)) + subjects.append(subject * np.ones(mean_val.size).astype(np.int)) - bf.append(nroi) - return bf, gf0, sub, gfc + hrois.append(hroi) + prior_h0 = np.concatenate(prior_h0) + subjects = np.concatenate(subjects) + coords = np.concatenate(coords) + return hrois, prior_h0, subjects, coords -def dpmm(gfc, alpha, g0, g1, dof, prior_precision, gf1, sub, burnin, - spatial_coords=None, nis=1000, co_clust=False, verbose=False): +def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, sampling_coords=None, n_iter=1000, burnin=100, + co_clust=False, verbose=False): """Apply the dpmm analysis to compute clusters from regions coordinates """ from nipy.algorithms.clustering.imm import MixedIMM - dim = gfc.shape[1] + dim = coords.shape[1] migmm = MixedIMM(alpha, dim) - migmm.set_priors(gfc) - migmm.set_constant_densities(null_dens=g0, prior_dens=g1) + migmm.set_priors(coords) + migmm.set_constant_densities( + null_dens=null_density, prior_dens=null_density) migmm._prior_dof = dof migmm._prior_scale = np.diag(prior_precision[0] / dof) migmm._inv_prior_scale_ = [np.diag(dof * 1. / (prior_precision[0]))] - migmm.sample(gfc, null_class_proba=1 - gf1, niter=burnin, init=False, - kfold=sub) - if verbose: - print 'number of components: ', migmm.k + migmm.sample(coords, null_class_proba=prior_h0, niter=burnin, init=False, + kfold=subjects) # sampling - if co_clust: - like, pproba, co_clust = migmm.sample( - gfc, null_class_proba=1 - gf1, niter=nis, - sampling_points=spatial_coords, kfold=sub, co_clustering=co_clust) - if verbose: - print 'number of components: ', migmm.k + like, pproba, co_clustering = migmm.sample( + coords, null_class_proba=prior_h0, niter=n_iter, kfold=subjects, + sampling_points=sampling_coords, co_clustering=True) - return like, 1 - pproba, co_clust + if co_clust: + return like, 1 - pproba, co_clustering else: - like, pproba = migmm.sample( - gfc, null_class_proba=1 - gf1, niter=nis, - sampling_points=spatial_coords, kfold=sub, co_clustering=co_clust) - if verbose: - print 'number of components: ', migmm.k - - return like, 1 - pproba + return like, 1 - pproba -def bsa_dpmm(bf, gf0, sub, gfc, dmax, thq, ths, verbose=0): +def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, + prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, + verbose=0): """ Estimation of the population level model of activation density using dpmm and inference Parameters ---------- - bf list of nipy.labs.spatial_models.hroi.HierarchicalROI instances + hrois: list of nipy.labs.spatial_models.hroi.HierarchicalROI instances representing individual ROIs - let nr be the number of terminal regions across subjects - gf0, array of shape (nr) + Let nr be the number of terminal regions across subjects + prior_h0: array of shape (nr) the mixture-based prior probability that the terminal regions are true positives - sub, array of shape (nr) + subjects: array of shape (nr) the subject index associated with the terminal regions - gfc, array of shape (nr, coord.shape[1]) + coords: array of shape (nr, coord.shape[1]) the coordinates of the of the terminal regions - dmax float>0: - expected cluster std in the common space in units of coord - thq = 0.5 (float in the [0,1] interval) - p-value of the prevalence test - ths=0, float in the rannge [0,nsubj] - null hypothesis on region prevalence that is rejected during inference + sigma: float>0, + expected cluster scatter in the common space in units of coord + prevalence_pval: float in the [0,1] interval, optional + p-value of the prevalence test + prevalence_threshold: float in the rannge [0,nsubj] + null hypothesis on region prevalence verbose=0, verbosity mode Returns ------- - crmap: array of shape (nnodes): - the resulting group-level labelling of the space - LR: a instance of sbf.LandmarkRegions that describes the ROIs found - in inter-subject inference - If no such thing can be defined LR is set to None - bf: List of nipy.labs.spatial_models.hroi.Nroi instances - representing individual ROIs - p: array of shape (nnodes): - likelihood of the data under H1 over some sampling grid + label_map: array of shape (nnodes): + the resulting group-level labelling of the space + landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found + in inter-subject inference + If no such thing can be defined landmarks is set to None + hrois: List of nipy.labs.spatial_models.hroi.HierarchicalROI instances + representing individual ROIs + density: array of shape (nnodes): + likelihood of the data under H1 over some sampling grid """ from nipy.algorithms.graph.field import field_from_coo_matrix_and_data - dom = bf[0].domain - n_subj = len(bf) - - crmap = - np.ones(dom.size, np.int) - LR = None - p = np.zeros(dom.size) - if len(sub) < 1: - return crmap, LR, bf, p + domain = hrois[0].domain + n_subjects = len(hrois) - sub = np.concatenate(sub).astype(np.int) - gfc = np.concatenate(gfc) - gf0 = np.concatenate(gf0) + label_map = - np.ones(domain.size, np.int) + landmarks = None + density = np.zeros(domain.size) + if len(subjects) < 1: + return label_map, landmarks, hrois, density - g0 = 1. / dom.local_volume.sum() + null_density = 1. / domain.local_volume.sum() # prepare the DPMM - dim = dom.em_dim - g1 = g0 - prior_precision = 1. / (dmax * dmax) * np.ones((1, dim)) - dof = 10 - burnin = 100 - nis = 1000 - # nis = number of iterations to estimate p - p, q = dpmm(gfc, 0.5, g0, g1, dof, prior_precision, 1 - gf0, - sub, burnin, dom.coord, nis) - - if verbose: - h1, c1 = np.histogram((1 - gf0), bins=100) - h2, c2 = np.histogram(q, bins=100) - try: - import matplotlib.pylab as pl - pl.figure() - pl.plot(1 - gf0, q, '.') - pl.figure() - pl.bar(c1[:len(h1)], h1, width=0.005) - pl.bar(c2[:len(h2)] + 0.003, h2, width=0.005, color='r') - except ImportError: - pass - print 'Number of candidate regions %i, regions found %i' % ( - np.size(q), q.sum()) - - Fbeta = field_from_coo_matrix_and_data(dom.topology, p) - _, label = Fbeta.custom_watershed(0, g0) + dim = domain.em_dim + prior_precision = 1. / (sigma ** 2) * np.ones((1, dim)) + + # n_iter = number of iterations to estimate density + density, post_proba = _dpmm( + coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, domain.coord, n_iter=n_iter, burnin=burnin) + + Fbeta = field_from_coo_matrix_and_data(domain.topology, density) + _, label = Fbeta.custom_watershed(0, null_density) # append some information to the hroi in each subject - for s in range(n_subj): - bfs = bf[s] + for subject in range(n_subjects): + bfs = hrois[subject] if bfs.k > 0: leaves_pos = [bfs.select_id(k) for k in bfs.get_leaves_id()] - us = - np.ones(bfs.k).astype(np.int) # set posterior proba - lq = np.zeros(bfs.k) - lq[leaves_pos] = q[sub == s] - bfs.set_roi_feature('posterior_proba', lq) + post_proba_ = np.zeros(bfs.k) + post_proba_[leaves_pos] = post_proba[subjects == subject] + bfs.set_roi_feature('posterior_proba', post_proba_) # set prior proba - lq = np.zeros(bfs.k) - lq[leaves_pos] = 1 - gf0[sub == s] - bfs.set_roi_feature('prior_proba', lq) - + prior_proba = np.zeros(bfs.k) + prior_proba[leaves_pos] = 1 - prior_h0[subjects == subject] + bfs.set_roi_feature('prior_proba', prior_proba) + + # assign labels to ROIs pos = np.asarray( [np.mean(coords, 0) for coords in bfs.get_coord()]) - midx = [np.argmin(np.sum((dom.coord - pos[k]) ** 2, 1)) - for k in range(bfs.k)] - j = label[np.array(midx)] - us[leaves_pos] = j[leaves_pos] + midx = np.array([np.argmin(np.sum((domain.coord - pos[k]) ** 2, 1)) + for k in range(bfs.k)]) + roi_label = - np.ones(bfs.k).astype(np.int) + j = label[midx] + roi_label[leaves_pos] = j[leaves_pos] # when parent regions has similarly labelled children, # include it also - us = bfs.make_forest().propagate_upward(us) - bfs.set_roi_feature('label', us) + roi_label = bfs.make_forest().propagate_upward(roi_label) + bfs.set_roi_feature('label', roi_label) # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - LR, nl = build_LR(bf, thq, ths, dmax, verbose=verbose) + landmarks, new_values = build_LR( + hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # make a group-level map of the landmark position - crmap = _relabel_(label, nl) - return crmap, LR, bf, p + label_map = _relabel(label, new_values) + return label_map, landmarks, hrois, density -def bsa_dpmm2(bf, gf0, sub, gfc, dmax, thq, ths, verbose): +def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, + prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, + verbose=False): """ Estimation of the population level model of activation density using dpmm and inference Parameters ---------- - bf list of nipy.labs.spatial_models.hroi.HierarchicalROI instances + hrois list of nipy.labs.spatial_models.hroi.HierarchicalROI instances representing individual ROIs let nr be the number of terminal regions across subjects - gf0, array of shape (nr) + prior_h0, array of shape (nr) the mixture-based prior probability that the terminal regions are false positives - sub, array of shape (nr) + subjects, array of shape (nr) the subject index associated with the terminal regions - gfc, array of shape (nr, coord.shape[1]) + coords, array of shape (nr, coord.shape[1]) the coordinates of the of the terminal regions - dmax float>0: + sigma float>0: expected cluster std in the common space in units of coord - thq = 0.5 (float in the [0,1] interval) + prevalence_pval = 0.5 (float in the [0,1] interval) p-value of the prevalence test - ths=0, float in the rannge [0,nsubj] + prevalence_threshold=0, float in the rannge [0,nsubj] null hypothesis on region prevalence that is rejected during inference verbose=0, verbosity mode Returns ------- - crmap: array of shape (nnodes): + label_map: array of shape (nnodes): the resulting group-level labelling of the space - LR: a instance of sbf.LandmarkRegions that describes the ROIs found + landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found in inter-subject inference - If no such thing can be defined LR is set to None - bf: List of nipy.labs.spatial_models.hroi.Nroi instances + If no such thing can be defined landmarks is set to None + hrois: List of nipy.labs.spatial_models.hroi.Nroi instances representing individual ROIs Coclust: array of shape (nr,nr): co-labelling matrix that gives for each pair of inputs how likely they are in the same class according to the model """ - dom = bf[0].domain - n_subj = len(bf) - crmap = - np.ones(dom.size, np.int) - LR = None - p = np.zeros(dom.size) - if len(sub) < 1: - return crmap, LR, bf, p - - sub = np.concatenate(sub).astype(np.int) - gfc = np.concatenate(gfc) - gf0 = np.concatenate(gf0) + domain = hrois[0].domain + n_subjects = len(hrois) + label_map = - np.ones(domain.size, np.int) + landmarks = None + density = np.zeros(domain.size) + if len(subjects) < 1: + return label_map, landmarks, hrois, density # prepare the DPMM - g0 = 1. / (np.sum(dom.local_volume)) - g1 = g0 - prior_precision = 1. / (dmax * dmax) * np.ones((1, dom.em_dim), np.float) - dof = 10 - burnin = 100 - nis = 300 - - q, p, CoClust = dpmm(gfc, .5, g0, g1, dof, prior_precision, 1 - gf0, - sub, burnin, nis=nis, co_clust=True) + null_density = 1. / (np.sum(domain.local_volume)) + prior_precision = 1. / (sigma ** 2) * np.ones((1, domain.em_dim), np.float) - cg = wgraph_from_coo_matrix(CoClust) - if cg.E > 0: - cg.remove_edges(cg.weights > .5) - u = cg.cc() - u[p < g0] = u.max() + 1 + np.arange(np.sum(p < g0)) + post_proba, density, co_clustering = _dpmm( + coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, n_iter=n_iter, burnin=burnin, co_clust=True) - if verbose: - cg.show(gfc) + contingency_graph = wgraph_from_coo_matrix(co_clustering) + if contingency_graph.E > 0: + contingency_graph.remove_edges(contingency_graph.weights > .5) + + components = contingency_graph.cc() + components[density < null_density] = components.max() + 1 +\ + np.arange(np.sum(density < null_density)) # append some information to the hroi in each subject - for s in range(n_subj): - bfs = bf[s] + for subject in range(n_subjects): + bfs = hrois[subject] if bfs is not None: if bfs.k > 0: leaves = np.asarray( [bfs.select_id(id) for id in bfs.get_leaves_id()]) - us = - np.ones(bfs.k).astype(np.int) - lq = np.zeros(bfs.k) - lq[leaves] = q[sub == s] - bfs.set_roi_feature('posterior_proba', lq) - lq = np.zeros(bfs.k) - lq[leaves] = 1 - gf0[sub == s] - bfs.set_roi_feature('prior_proba', lq) - us[leaves] = u[sub == s] + roi_label = - np.ones(bfs.k).astype(np.int) + + # posterior proba of activation + post_proba_ = np.zeros(bfs.k) + post_proba_[leaves] = post_proba[subjects == subject] + bfs.set_roi_feature('posterior_proba', post_proba_) + + # prior_proba of activation + prior_proba = np.zeros(bfs.k) + prior_proba[leaves] = 1 - prior_h0[subjects == subject] + bfs.set_roi_feature('prior_proba', prior_proba) + roi_label[leaves] = components[subjects == subject] # when parent regions has similarly labelled children, # include it also - us = bfs.make_forest().propagate_upward(us) - bfs.set_roi_feature('label', us) + roi_label = bfs.make_forest().propagate_upward(roi_label) + bfs.set_roi_feature('label', roi_label) else: bfs.set_roi_feature('label', np.array([])) - bf[s] = bfs # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - LR, nl = build_LR(bf, thq, ths, dmax, verbose=verbose) + landmarks, _ = build_LR( + hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # make a group-level map of the landmark position - crmap = - np.ones(dom.size) + label_map = - np.ones(domain.size) # not implemented at the moment - return crmap, LR, bf, CoClust + return label_map, landmarks, hrois, co_clustering ########################################################################### -# Main functions +# Main function ########################################################################### -def compute_BSA_simple(dom, lbeta, dmax, thq=0.5, smin=5, ths=0, theta=3.0, - method='prior', verbose=0): +def compute_landmarks( + domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, + threshold=3.0, smin=5, method='prior', algorithm='quick', verbose=0): """ Compute the Bayesian Structural Activation paterns simplified version Parameters ---------- - dom : StructuredDomain instance, + domain : StructuredDomain instance, Description of the spatial context of the data - lbeta: an array of shape (nbnodes, subjects): + stats: an array of shape (nbnodes, subjects): the multi-subject statistical maps - dmax float>0: + sigma float>0: expected cluster std in the common space in units of coord - thq = 0.5 (float): + prevalence_pval = 0.5 (float): posterior significance threshold should be in the [0,1] interval smin = 5 (int): minimal size of the regions to validate them - theta = 3.0 (float): first level threshold + threshold = 3.0 (float): first level threshold method: string, optional, the method used to assess the prior significance of the regions + algorithm: string, one of ['quick', 'standard'], + method used to compute the landmarks verbose=0: verbosity mode Returns ------- - crmap: array of shape (nnodes): + label_map: array of shape (nnodes): the resulting group-level labelling of the space - LR: a instance of sbf.LandmarkRegions that describes the ROIs found + landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found in inter-subject inference - If no such thing can be defined LR is set to None - bf: List of nipy.labs.spatial_models.hroi.Nroi instances + If no such thing can be defined landmarks is set to None + hrois: List of nipy.labs.spatial_models.hroi.Nroi instances representing individual ROIs - p: array of shape (nnodes): + density: array of shape (nnodes): likelihood of the data under H1 over some sampling grid Notes @@ -481,127 +463,19 @@ def compute_BSA_simple(dom, lbeta, dmax, thq=0.5, smin=5, ths=0, theta=3.0, significant local maxima in the volume. Each terminal (leaf) region which is a posteriori significant enough is assigned to the nearest mode of this distribution - - fixme - ----- - The number of itertions should become a parameter - """ - bf, gf0, sub, gfc = compute_individual_regions( - dom, lbeta, smin, theta, 'prior', verbose) - - crmap, LR, bf, p = bsa_dpmm(bf, gf0, sub, gfc, dmax, thq, ths, verbose) - return crmap, LR, bf, p - - -def compute_BSA_quick(dom, lbeta, dmax, thq=0.5, smin=5, ths=0, theta=3.0, - verbose=0): - """Idem compute_BSA_simple, but this one does not estimate the full density - (on small datasets, it can be much faster) - - Parameters - ---------- - dom : StructuredDomain instance, - Description of the spatial context of the data - lbeta: an array of shape (nbnodes, subjects): - the multi-subject statistical maps - dmax float>0: - expected cluster std in the common space in units of coord - thq = 0.5 (float): - posterior significance threshold - should be in the [0,1] interval - smin = 5 (int): minimal size of the regions to validate them - theta = 3.0 (float): first level threshold - method: string, optional, - the method used to assess the prior significance of the regions - verbose=0: verbosity mode - - Returns - ------- - crmap: array of shape (nnodes): - the resulting group-level labelling of the space - LR: a instance of sbf.LandmarkRegions that describes the ROIs found - in inter-subject inference - If no such thing can be defined LR is set to None - bf: List of nipy.labs.spatial_models.hroi.Nroi instances - representing individual ROIs - coclust: array of shape (nr, nr): - co-labelling matrix that gives for each pair of cross_subject regions - how likely they are in the same class according to the model - """ - bf, gf0, sub, gfc = compute_individual_regions( - dom, lbeta, smin, theta, 'prior', verbose) - crmap, LR, bf, co_clust = bsa_dpmm2( - bf, gf0, sub, gfc, dmax, thq, ths, verbose) - return crmap, LR, bf, co_clust - - -def compute_BSA_loo(dom, lbeta, dmax, thq=0.5, smin=5, ths=0, theta=3.0, - verbose=0): - """ Compute the Bayesian Structural Activation paterns - - with statistical validation - - Parameters - ---------- - dom: StructuredDomain instance, - Description of the spatial context of the data - lbeta: an array of shape (nbnodes, subjects): - the multi-subject statistical maps - dmax float>0: - expected cluster std in the common space in units of coord - thq = 0.5 (float): - posterior significance threshold - should be in the [0,1] interval - smin = 5 (int): minimal size of the regions to validate them - theta = 3.0 (float): first level threshold - method: string, optional, - the method used to assess the prior significance of the regions - verbose=0: verbosity mode - - Returns - ------- - mll : float - the average cross-validated log-likelihood across subjects - ml0 : float - the log-likelihood of the model under a global null hypothesis """ - n_subj = lbeta.shape[1] - nvox = dom.size - bf, gf0, sub, gfc = compute_individual_regions( - dom, lbeta, smin, theta, 'gauss_mixture', verbose) - - p = np.zeros(nvox) - g0 = 1. / (np.sum(dom.local_volume)) - if len(sub) < 1: - return np.log(g0), np.log(g0) - - sub = np.concatenate(sub).astype(np.int) - gfc = np.concatenate(gfc) - gf0 = np.concatenate(gf0) - - # prepare the DPMM - g1 = g0 - dim = dom.em_dim - prior_precision = 1. / (dmax * dmax) * np.ones((1, dim), np.float) - dof = 10 - burnin = 100 - nis = 300 - ll0 = [] - ll2 = [] - - for s in range(n_subj): - if np.sum(sub == s) > 0: - spatial_coords = gfc[sub == s] - p, q = dpmm( - gfc[sub != s], 0.5, g0, g1, dof, prior_precision, - 1 - gf0[sub != s], sub[sub != s], burnin, spatial_coords, nis) - pp = gf0[sub == s] * g0 + p * (1 - gf0[sub == s]) - ll2.append(np.mean(np.log(pp))) - ll0.append(np.mean(np.log(g0))) - - ml0 = np.mean(np.array(ll0)) - mll = np.mean(np.array(ll2)) - if verbose: - print 'average cross-validated log likelihood' - print 'null model: ', ml0, ' alternative model: ', mll - - return mll, ml0 + hrois, prior_h0, subjects, coords = _compute_individual_regions( + domain, stats, threshold, smin, method, verbose) + + if algorithm == 'standard': + label_map, landmarks, hrois, density = bsa_dpmm( + hrois, prior_h0, subjects, coords, sigma, prevalence_pval, + prevalence_threshold, verbose=verbose) + return label_map, landmarks, hrois, density + elif algorithm == 'quick': + label_map, landmarks, hrois, co_clust = bsa_dpmm2( + hrois, prior_h0, subjects, coords, sigma, prevalence_pval, + prevalence_threshold, verbose=verbose) + return label_map, landmarks, hrois, co_clust + else: + raise ValueError('Unknown method') diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 8dad2408f8..75f6d9b3cb 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -10,8 +10,7 @@ from nibabel import load, save, Nifti1Image from ..mask import intersect_masks -from .bayesian_structural_analysis import (compute_BSA_simple, - compute_BSA_quick, compute_BSA_loo) +from .bayesian_structural_analysis import compute_landmarks from .discrete_domain import domain_from_image @@ -41,7 +40,7 @@ def make_bsa_image( swd: string, optional if not None, output directory method='simple': applied region detection method; to be chose among - 'simple', 'quick', 'loo' + 'simple', 'quick' subj_id=None: list of strings, identifiers of the subjects. by default it is range(nsubj) nbeta='default', string, identifier of the contrast @@ -64,11 +63,6 @@ def make_bsa_image( BF : a list of nipy.labs.spatial_models.hroi.Nroi instances (one per subject) that describe the individual coounterpart of AF - if method=='loo', the output is different: - mll, float, the average likelihood of the data under the model - after cross validation - ll0, float the log-likelihood of the data under the global null - fixme ===== unique mask should be allowed @@ -112,21 +106,18 @@ def make_bsa_image( BF = [None for s in range(nsubj)] if method == 'simple': - crmap, AF, BF, p = compute_BSA_simple( - dom, lbeta, dmax, thq, smin, ths, theta, verbose=verbose) + crmap, AF, BF, p = compute_landmarks( + dom, lbeta, dmax, thq, ths, theta, smin, algorithm='standard', + verbose=verbose) if method == 'quick': - crmap, AF, BF, co_clust = compute_BSA_quick( - dom, lbeta, dmax, thq, smin, ths, theta, verbose=verbose) + crmap, AF, BF, co_clust = compute_landmarks( + dom, lbeta, dmax, thq, ths, theta, smin, algorithm='quick', + verbose=verbose) density = np.zeros(nvox) crmap = AF.map_label(dom.coord, 0.95, dmax) - if method == 'loo': - mll, ll0 = compute_BSA_loo( - dom, lbeta, dmax, thq, smin, ths, theta, verbose=verbose) - return mll, ll0 - # Write the results as images # the spatial density image if dens_path is not False: diff --git a/nipy/labs/spatial_models/tests/test_bsa.py b/nipy/labs/spatial_models/tests/test_bsa.py index 6f7187753a..a4066a40d7 100644 --- a/nipy/labs/spatial_models/tests/test_bsa.py +++ b/nipy/labs/spatial_models/tests/test_bsa.py @@ -14,7 +14,7 @@ from nipy.testing import dec from ...utils.simul_multisubject_fmri_dataset import surrogate_2d_dataset -from ..bayesian_structural_analysis import compute_BSA_simple +from ..bayesian_structural_analysis import compute_landmarks from ..discrete_domain import domain_from_binary_array @@ -40,8 +40,7 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, if method == 'simple': group_map, AF, BF, likelihood = \ - compute_BSA_simple(dom, lbeta, dmax, thq, smin, ths, - theta, g0, bdensity) + compute_landmarks(dom, lbeta, dmax, thq, ths, theta, smin) return AF, BF From 19485e02a1f7153f5107d4fe3dac79b73b26e1df Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 26 Mar 2013 16:59:47 +0100 Subject: [PATCH 141/164] More changes in related modules: variable naming, API --- examples/labs/bayesian_structural_analysis.py | 103 ++++++------ .../bayesian_structural_analysis.py | 6 +- nipy/labs/spatial_models/bsa_io.py | 150 +++++++++--------- nipy/labs/spatial_models/structural_bfls.py | 101 ++++++------ 4 files changed, 178 insertions(+), 182 deletions(-) diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index 99e9e4c568..e23cc46224 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -8,7 +8,7 @@ Requires matplotlib -Author : Bertrand Thirion, 2009-2011 +Author : Bertrand Thirion, 2009-2013 """ print(__doc__) @@ -21,26 +21,27 @@ raise RuntimeError("This script needs the matplotlib library") import nipy.labs.utils.simul_multisubject_fmri_dataset as simul -import nipy.labs.spatial_models.bayesian_structural_analysis as bsa +from nipy.labs.spatial_models.bayesian_structural_analysis import\ + compute_landmarks from nipy.labs.spatial_models.discrete_domain import domain_from_binary_array -def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, - method='simple', verbose=0): +def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, + prevalence_pval=0.5, smin=0, method='simple', verbose=0): """ Function for performing bayesian structural analysis on a set of images. Parameters ---------- - betas, array of shape (nsubj, dimx, dimy) the data used + betas, array of shape (n_subjects, dimx, dimy) the data used Note that it is assumed to be a t- or z-variate - theta=3., float, + threshold=3., float, first level threshold of betas - dmax=5., float, expected between subject variability - ths=0, float, + sigma=5., float, expected between subject variability + prevalence_threshold=0, float, null hypothesis for the prevalence statistic - thq=0.5, float, + prevalence_pval=0.5, float, p-value of the null rejection smin=0, int, threshold on the nu_mber of contiguous voxels @@ -52,11 +53,11 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, Returns ------- - AF the landmark_regions instance describing the result - BF: list of hroi instances describing the individual data + landmarks the landmark_regions instance describing the result + hrois: list of hroi instances describing the individual data """ ref_dim = np.shape(betas[0]) - nsubj = betas.shape[0] + n_subjects = betas.shape[0] xyz = np.array(np.where(betas[:1])).T.astype(np.int) # Get coordinates in mm @@ -64,35 +65,31 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, coord = xyz.astype(np.float) # get the functional information - lbeta = np.array([np.ravel(betas[k]) for k in range(nsubj)]).T + stats = np.array([np.ravel(betas[k]) for k in range(n_subjects)]).T lmax = 0 - bdensity = 1 - dom = domain_from_binary_array(np.ones(ref_dim)) + domain = domain_from_binary_array(np.ones(ref_dim)) if method == 'simple': - group_map, AF, BF, likelihood = \ - bsa.compute_BSA_simple(dom, lbeta, dmax, thq, smin, ths, - theta) - if method == 'quick': + group_map, landmarks, hrois, likelihood = compute_landmarks( + domain, stats, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, method='prior', + algorithm='standard') + elif method == 'quick': likelihood = np.zeros(ref_dim) - group_map, AF, BF, coclustering = \ - bsa.compute_BSA_quick(dom, lbeta, dmax, thq, smin, ths, - theta) - if method == 'loo': - mll, ll0 = bsa.compute_BSA_loo(dom, lbeta, dmax, thq, smin, ths, - theta, bdensity) - return mll, ll0 - - if method not in['loo', 'simple', 'quick']: + group_map, landmarks, hrois, coclustering = compute_landmarks( + domain, stats, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, method='prior', + algorithm='quick') + else: raise ValueError('method is not correctly defined') if verbose == 0: - return AF, BF + return landmarks, hrois - if AF != None: - lmax = AF.k + 2 - AF.show() + if landmarks != None: + lmax = landmarks.k + 2 + landmarks.show() group_map.shape = ref_dim plt.figure(figsize=(8, 3)) @@ -102,8 +99,8 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, plt.axis('off') plt.colorbar(shrink=.8) - if AF != None: - group_map = AF.map_label(coord, 0.95, dmax) + if landmarks != None: + group_map = landmarks.map_label(coord, 0.95, sigma) group_map.shape = ref_dim plt.subplot(1, 3, 2) @@ -122,27 +119,27 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, fig_output = plt.figure(figsize=(8, 3.5)) fig_output.text(.5, .9, "Individual landmark regions", ha="center") - for s in range(nsubj): - ax = plt.subplot(nsubj / 5, 5, s + 1) + for s in range(n_subjects): + ax = plt.subplot(n_subjects / 5, 5, s + 1) #ax.set_position([.02, .02, .96, .96]) lw = - np.ones(ref_dim) - if BF[s] is not None: - nls = BF[s].get_roi_feature('label') - nls[nls == - 1] = np.size(AF) + 2 - for k in range(BF[s].k): - np.ravel(lw)[BF[s].label == k] = nls[k] + if hrois[s] is not None: + nls = hrois[s].get_roi_feature('label') + nls[nls == - 1] = np.size(landmarks) + 2 + for k in range(hrois[s].k): + np.ravel(lw)[hrois[s].label == k] = nls[k] plt.imshow(lw, interpolation='nearest', vmin=-1, vmax=lmax) plt.axis('off') fig_input = plt.figure(figsize=(8, 3.5)) fig_input.text(.5,.9, "Input activation maps", ha='center') - for s in range(nsubj): - plt.subplot(nsubj / 5, 5, s + 1) + for s in range(n_subjects): + plt.subplot(n_subjects / 5, 5, s + 1) plt.imshow(betas[s], interpolation='nearest', vmin=betas.min(), vmax=betas.max()) plt.axis('off') - return AF, BF + return landmarks, hrois ############################################################################### @@ -150,26 +147,26 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, ############################################################################### # generate the data -n_subj = 10 +n_subjects = 10 shape = (60, 60) pos = np.array([[12, 14], [20, 20], [30, 20]]) ampli = np.array([5, 7, 6]) sjitter = 1.0 -betas = simul.surrogate_2d_dataset(n_subj=n_subj, shape=shape, pos=pos, +betas = simul.surrogate_2d_dataset(n_subj=n_subjects, shape=shape, pos=pos, ampli=ampli, width=5.0) # set various parameters -theta = float(st.t.isf(0.01, 100)) -dmax = 4. / 1.5 -ths = n_subj / 4 -thq = 0.9 +threshold = float(st.t.isf(0.01, 100)) +sigma = 4. / 1.5 +prevalence_threshold = n_subjects * .25 +prevalence_pval = 0.9 verbose = 1 smin = 5 -method = 'simple' # 'quick' # 'loo' # +method = 'quick' # 'simple' # # run the algo -AF, BF = make_bsa_2d(betas, theta, dmax, ths, thq, smin, method, - verbose=verbose) +landmarks, hrois = make_bsa_2d(betas, threshold, sigma, prevalence_threshold, + prevalence_pval, smin, method, verbose=verbose) plt.show() diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 59fd9d30d7..2bd586835e 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -18,7 +18,7 @@ import numpy as np import scipy.stats as st -from .structural_bfls import build_LR +from .structural_bfls import build_landmarks from nipy.algorithms.graph import wgraph_from_coo_matrix from ...algorithms.statistics.empirical_pvalue import \ NormalEmpiricalNull, three_classes_GMM_fit, gamma_gaussian_fit @@ -305,7 +305,7 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - landmarks, new_values = build_LR( + landmarks, new_values = build_landmarks( hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # make a group-level map of the landmark position @@ -406,7 +406,7 @@ def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - landmarks, _ = build_LR( + landmarks, _ = build_landmarks( hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # make a group-level map of the landmark position diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 75f6d9b3cb..5bfeb983f2 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -15,9 +15,10 @@ def make_bsa_image( - mask_images, betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, swd=None, - method='simple', subj_id=None, nbeta='default', dens_path=None, - cr_path=None, verbose=0, reshuffle=False): + mask_images, stat_images, threshold=3., sigma=5., prevalence_threshold=0, + prevalence_pval=0.5, smin=0, write_dir=None, method='simple', + subjects_id=None, contrast_id='default', dens_path=None, cr_path=None, + verbose=0): """ Main function for performing bsa on a set of images. It creates the some output images in the given directory @@ -25,55 +26,55 @@ def make_bsa_image( ---------- mask_images: A list of image paths that yield binary images, one for each subject - the number os subjects, nsubj, is taken as len(mask_images) - betas: A list of image paths that yields the activation images, + the number os subjects, n_subjects, is taken as len(mask_images) + stat_images: A list of image paths that yields the activation images, one for each subject - theta=3., threshold used to ignore all the image data that si below - dmax=5., prior width of the spatial model + threshold=3., threshold used to ignore all the image data that si below + sigma=5., prior width of the spatial model corresponds to multi-subject uncertainty - ths=0: threshold on the representativity measure of the obtained - regions - thq=0.5: p-value of the representativity test: - test = p(representativity>ths)>thq - smin=0: minimal size (in voxels) of the extracted blobs - smaller blobs are merged into larger ones - swd: string, optional - if not None, output directory - method='simple': applied region detection method; to be chose among - 'simple', 'quick' - subj_id=None: list of strings, identifiers of the subjects. - by default it is range(nsubj) - nbeta='default', string, identifier of the contrast + prevalence_threshold: float, optional + threshold on the representativity measure + prevalence_pval: float, optional + p-value of the representativity test: + test = p(representativity>prevalence_threshold) > prevalence_pval + smin: float, optional + minimal size (in voxels) of the extracted blobs + smaller blobs are merged into larger ones + write_dir: string, optional + if not None, output directory + method: string, one of ['simple', 'quick'], optional, + applied region detection method; to be chose among + subjects_id=None: list of strings, identifiers of the subjects. + by default it is range(n_subjects) + contrast_id='default', string, identifier of the contrast dens_path=None, string, path of the output density image if False, no image is written - if None, the path is computed from swd, nbeta + if None, the path is join(write_dir, density_contrast_id.nii) cr_path=None, string, path of the (4D) output label image - if False, no ime is written + if False, no image is written if None, many images are written, - with paths computed from swd, subj_id and nbeta - reshuffle: bool, optional - if true, randomly swap the sign of the data + with paths computed from write_dir, subjects_id and contrast_id Returns ------- - AF: an nipy.labs.spatial_models.structural_bfls.landmark_regions + landmarks: an nipy.labs.spatial_models.structural_bfls.landmark_regions instance that describes the structures found at the group level None is returned if nothing has been found significant at the group level - BF : a list of nipy.labs.spatial_models.hroi.Nroi instances - (one per subject) that describe the individual coounterpart of AF + hrois : a list of nipy.labs.spatial_models.hroi.Nroi instances + (one per subject) that describe the individual coounterpart of landmarks fixme ===== unique mask should be allowed """ # Sanity check - if len(mask_images) != len(betas): + if len(mask_images) != len(stat_images): raise ValueError("the number of masks and activation images" \ "should be the same") - nsubj = len(mask_images) - if subj_id == None: - subj_id = [str(i) for i in range(nsubj)] + n_subjects = len(mask_images) + if subjects_id == None: + subjects_id = [str(subject) for subject in range(n_subjects)] # Read the referential information nim = load(mask_images[0]) @@ -84,63 +85,59 @@ def make_bsa_image( mask = np.reshape(intersect_masks(mask_images), ref_dim).astype('u8') # encode it as a domain - dom = domain_from_image(Nifti1Image(mask, affine), nn=18) - nvox = dom.size + domain = domain_from_image(Nifti1Image(mask, affine), nn=18) + nvox = domain.size # read the functional images lbeta = [] - for s in range(nsubj): - rbeta = load(betas[s]) + for subject in range(n_subjects): + rbeta = load(stat_images[subject]) beta = np.reshape(rbeta.get_data(), ref_dim) lbeta.append(beta[mask > 0]) lbeta = np.array(lbeta).T - if reshuffle: - rswap = 2 * (np.random.randn(nsubj) > 0.5) - 1 - lbeta = np.dot(lbeta, np.diag(rswap)) - # launch the method crmap = np.zeros(nvox) - p = np.zeros(nvox) - AF = None - BF = [None for s in range(nsubj)] + density = np.zeros(nvox) + landmarks = None + hrois = [None for s in range(n_subjects)] if method == 'simple': - crmap, AF, BF, p = compute_landmarks( - dom, lbeta, dmax, thq, ths, theta, smin, algorithm='standard', - verbose=verbose) + crmap, landmarks, hrois, density = compute_landmarks( + domain, lbeta, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, algorithm='standard', verbose=verbose) if method == 'quick': - crmap, AF, BF, co_clust = compute_landmarks( - dom, lbeta, dmax, thq, ths, theta, smin, algorithm='quick', - verbose=verbose) + crmap, landmarks, hrois, co_clust = compute_landmarks( + domain, lbeta, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, algorithm='quick', verbose=verbose) density = np.zeros(nvox) - crmap = AF.map_label(dom.coord, 0.95, dmax) + crmap = landmarks.map_label(domain.coord, 0.95, sigma) # Write the results as images # the spatial density image if dens_path is not False: - density = np.zeros(ref_dim) - density[mask > 0] = p - wim = Nifti1Image(density, affine) + density_map = np.zeros(ref_dim) + density_map[mask > 0] = density + wim = Nifti1Image(density_map, affine) wim.get_header()['descrip'] = 'group-level spatial density \ of active regions' if dens_path == None: - dens_path = op.join(swd, "density_%s.nii" % nbeta) + dens_path = op.join(write_dir, "density_%s.nii" % contrast_id) save(wim, dens_path) if cr_path == False: - return AF, BF + return landmarks, hrois - default_idx = AF.k + 2 + default_idx = landmarks.k + 2 - if cr_path == None and swd == None: - return AF, BF + if cr_path == None and write_dir == None: + return landmarks, hrois if cr_path == None: # write a 3D image for group-level labels - cr_path = op.join(swd, "CR_%s.nii" % nbeta) + cr_path = op.join(write_dir, "CR_%s.nii" % contrast_id) labels = - 2 * np.ones(ref_dim) labels[mask > 0] = crmap wim = Nifti1Image(labels.astype('int16'), affine) @@ -148,22 +145,23 @@ def make_bsa_image( save(wim, cr_path) # write a prevalence image - cr_path = op.join(swd, "prevalence_%s.nii" % nbeta) - prev = np.zeros(ref_dim) - prev[mask > 0] = AF.prevalence_density() - wim = Nifti1Image(prev, affine) + cr_path = op.join(write_dir, "prevalence_%s.nii" % contrast_id) + prevalence_map = np.zeros(ref_dim) + prevalence_map[mask > 0] = landmarks.prevalence_density() + wim = Nifti1Image(prevalence_map, affine) wim.get_header()['descrip'] = 'Weighted prevalence image' save(wim, cr_path) # write 3d images for the subjects - for s in range(nsubj): - label_image = op.join(swd, "AR_s%s_%s.nii" % (subj_id[s], nbeta)) + for subject in range(n_subjects): + label_image = op.join(write_dir, "AR_s%s_%s.nii" % ( + subjects_id[subject], contrast_id)) labels = - 2 * np.ones(ref_dim) labels[mask > 0] = -1 - if BF[s] is not None: - nls = BF[s].get_roi_feature('label').astype(np.int) + if hrois[subject] is not None: + nls = hrois[subject].get_roi_feature('label').astype(np.int) nls[nls == - 1] = default_idx - lab = BF[s].label + lab = hrois[subject].label lab[lab > - 1] = nls[lab[lab > - 1]] labels[mask > 0] = lab @@ -173,20 +171,20 @@ def make_bsa_image( save(wim, label_image) else: # write everything in a single 4D image - wdim = (ref_dim[0], ref_dim[1], ref_dim[2], nsubj + 1) + wdim = (ref_dim[0], ref_dim[1], ref_dim[2], n_subjects + 1) labels = - 2 * np.ones(wdim, 'int16') labels[mask > 0, 0] = crmap - for s in range(nsubj): - labels[mask > 0, s + 1] = - 1 - if BF[s] is not None: - nls = BF[s].get_roi_feature('label') + for subject in range(n_subjects): + labels[mask > 0, subject + 1] = - 1 + if hrois[s] is not None: + nls = hrois[subject].get_roi_feature('label') nls[nls == - 1] = default_idx - lab = BF[s].label + lab = hrois[subject].label lab[lab > - 1] = nls[lab[lab > - 1]] - labels[mask > 0, s + 1] = lab + labels[mask > 0, subject + 1] = lab wim = Nifti1Image(labels, affine) wim.get_header()['descrip'] = 'group Level and individual labels\ from bsa procedure' save(wim, cr_path) - return AF, BF + return landmarks, hrois diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index 94676500fb..8ee4f6abb4 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -26,7 +26,7 @@ class LandmarkRegions(object): not implemented yet. """ - def __init__(self, domain, k, indiv_coord, subj, id=''): + def __init__(self, domain, k, indiv_coord, subjects, id=''): """ Building the landmark_region Parameters @@ -36,7 +36,7 @@ def __init__(self, domain, k, indiv_coord, subj, id=''): k: int, the number of regions considered indiv_coord: k-length list of arrays, optional, coordinates of the nodes in some embedding space. - subj: k-length list of integers + subjects: k-length list of integers these correspond to and ROI feature: the subject index of individual regions @@ -47,7 +47,7 @@ def __init__(self, domain, k, indiv_coord, subj, id=''): self.id = id self.features = {} self.set_feature('position', indiv_coord) - self.set_feature('subjects', subj) + self.set_feature('subjects', subjects) def set_feature(self, fid, data): """ @@ -233,25 +233,25 @@ def show(self): """function to print basic information on self """ centers = self.centers() - subj = self.get_feature('subjects') + subjects = self.get_feature('subjects') prevalence = self.roi_prevalence() print "index", "prevalence", "mean_position", "individuals" for i in range(self.k): - print i, prevalence[i], centers[i], np.unique(subj[i]) + print i, prevalence[i], centers[i], np.unique(subjects[i]) - def roi_confidence(self, ths=0, fid='confidence'): + def roi_confidence(self, prevalence_threshold=0, fid='confidence'): """ assuming that a certain feature fid field has been set as a discrete feature, this creates an approximate p-value that states how confident one might - that the LR is defined in at least ths individuals + that the LR is defined in at least prevalence_threshold individuals if conficence is not defined as a discrete_feature, it is assumed to be 1. Parameters ---------- - ths: integer that yields the representativity threshold + prevalence_threshold: integer that yields the representativity threshold Returns ------- @@ -259,16 +259,17 @@ def roi_confidence(self, ths=0, fid='confidence'): the p-values corresponding to the ROIs """ pvals = np.zeros(self.k) - subj = self.get_feature('subjects') + subjects = self.get_feature('subjects') if fid not in self.features: # the feature has not been defined print 'using per ROI subject counts' for j in range(self.k): - pvals[j] = np.size(np.unique(subj[j])) - pvals = pvals > ths + 0.5 * (pvals == ths) + pvals[j] = np.size(np.unique(subjects[j])) + pvals = pvals > prevalence_threshold +\ + 0.5 * (pvals == prevalence_threshold) else: for j in range(self.k): - subjj = subj[j] + subjj = subjects[j] conf = self.get_feature(fid)[j] mp = 0. vp = 0. @@ -280,7 +281,7 @@ def roi_confidence(self, ths=0, fid='confidence'): # If noise is too low the variance is 0: ill-defined: vp = max(vp, 1e-14) - pvals[j] = stats.norm.sf(ths, mp, np.sqrt(vp)) + pvals[j] = stats.norm.sf(prevalence_threshold, mp, np.sqrt(vp)) return pvals def roi_prevalence(self, fid='confidence'): @@ -296,14 +297,14 @@ def roi_prevalence(self, fid='confidence'): the population_prevalence """ confid = np.zeros(self.k) - subj = self.get_feature('subjects') + subjects = self.get_feature('subjects') if fid not in self.features: for j in range(self.k): - subjj = subj[j] + subjj = subjects[j] confid[j] = np.size(np.unique(subjj)) else: for j in range(self.k): - subjj = subj[j] + subjj = subjects[j] conf = self.get_feature(fid)[j] for ls in np.unique(subjj): lmj = 1 - np.prod(1 - conf[subjj == ls]) @@ -346,20 +347,21 @@ def prevalence_density(self): return self.weighted_feature_density(self.roi_prevalence()) -def build_LR(bf, thq=0.95, ths=0, dmax=1., verbose=0): +def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, + dmax=1., verbose=0): """ Given a list of hierarchical ROIs, and an associated labelling, this creates an Amer structure wuch groups ROIs with the same label. Parameters ---------- - bf : list of nipy.labs.spatial_models.hroi.Nroi instances + hrois : list of nipy.labs.spatial_models.hroi.Nroi instances it is assumd that each list corresponds to one subject each HierarchicalROI is assumed to have the roi_features 'position', 'label' and 'posterior_proba' defined - thq=0.95, ths=0 defines the condition (c): - (c) A label should be present in ths subjects - with a probability>thq + prevalence_pval=0.95, prevalence_threshold=0 defines the condition (c): + (c) A label should be present in prevalence_threshold subjects + with a probability>prevalence_pval in order to be valid dmax: float optional, regularizing constant that defines a prior on the region extent @@ -373,36 +375,36 @@ def build_LR(bf, thq=0.95, ths=0, dmax=1., verbose=0): which discards labels that do not fulfill the condition (c) """ - dim = bf[0].domain.em_dim + dim = hrois[0].domain.em_dim # prepare various variables to ease information manipulation - nbsubj = np.size(bf) - subj = np.concatenate([s * np.ones(bf[s].k, np.int) - for s in range(nbsubj)]) - u = np.concatenate([bf[s].get_roi_feature('label') - for s in range(nbsubj)if bf[s].k > 0]) - u = np.squeeze(u) - if 'prior_proba' in bf[0].roi_features: - conf = np.concatenate([bf[s].get_roi_feature('prior_proba') - for s in range(nbsubj)if bf[s].k > 0]) + n_subjects = np.size(hrois) + subjects = np.concatenate([s * np.ones(hrois[s].k, np.int) + for s in range(n_subjects)]) + labels = np.concatenate([hrois[s].get_roi_feature('label') + for s in range(n_subjects)if hrois[s].k > 0]) + labels = np.squeeze(labels) + if 'prior_proba' in hrois[0].roi_features: + conf = np.concatenate([hrois[s].get_roi_feature('prior_proba') + for s in range(n_subjects)if hrois[s].k > 0]) else: - conf = np.ones(u.size) - intrasubj = np.concatenate([np.arange(bf[s].k) - for s in range(nbsubj)]) + conf = np.ones(labels.size) + intrasubj = np.concatenate([np.arange(hrois[s].k) + for s in range(n_subjects)]) coords = [] subjs = [] pps = [] - n_labels = int(u.max() + 1) + n_labels = int(labels.max() + 1) valid = np.zeros(n_labels).astype(np.int) # do some computation to find which regions are worth reporting - for i in np.unique(u[u > - 1]): + for i in np.unique(labels[labels > - 1]): mp = 0. vp = 0. - subjj = subj[u == i] + subjj = subjects[labels == i] for ls in np.unique(subjj): - lmj = 1 - np.prod(1 - conf[(u == i) * (subj == ls)]) + lmj = 1 - np.prod(1 - conf[(labels == i) * (subjects == ls)]) lvj = lmj * (1 - lmj) mp = mp + lmj vp = vp + lvj @@ -411,31 +413,30 @@ def build_LR(bf, thq=0.95, ths=0, dmax=1., verbose=0): vp = max(vp, 1e-14) # if above threshold, get some information to create the LR - if verbose: - print 'lr', i, valid.sum(), ths, mp, thq - - if stats.norm.sf(ths, mp, np.sqrt(vp)) > thq: + if (stats.norm.sf(prevalence_threshold, mp, np.sqrt(vp)) > + prevalence_pval): sj = np.size(subjj) coord = np.zeros((sj, dim)) - for (k, s, a) in zip(intrasubj[u == i], subj[u == i], range(sj)): - coord[a] = bf[s].get_roi_feature('position')[k] + for (k, s, a) in zip(intrasubj[labels == i], subjects[labels == i], + range(sj)): + coord[a] = hrois[s].get_roi_feature('position')[k] valid[i] = 1 coords.append(coord) subjs.append(subjj) - pps.append(conf[u == i]) + pps.append(conf[labels == i]) # relabel the ROIs maplabel = - np.ones(n_labels).astype(np.int) maplabel[valid > 0] = np.cumsum(valid[valid > 0]) - 1 - for s in range(nbsubj): - if bf[s].k > 0: - us = bf[s].get_roi_feature('label') + for subject in range(n_subjects): + if hrois[subject].k > 0: + us = hrois[s].get_roi_feature('label') us[us > - 1] = maplabel[us[us > - 1]] - bf[s].set_roi_feature('label', us) + hrois[subject].set_roi_feature('label', us) # create the landmark regions structure k = np.sum(valid) - LR = LandmarkRegions(bf[0].domain, k, indiv_coord=coords, subj=subjs) + LR = LandmarkRegions(hrois[0].domain, k, indiv_coord=coords, subjects=subjs) LR.set_feature('confidence', pps) return LR, maplabel From baff30bb47d4d04dc65dbf41d2041b2f59d0bdcf Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 27 Mar 2013 23:19:20 +0100 Subject: [PATCH 142/164] More variable renaming and simplifications --- .../need_data/bayesian_structural_analysis.py | 23 +-- .../bayesian_structural_analysis.py | 6 +- nipy/labs/spatial_models/bsa_io.py | 151 +++++++----------- nipy/labs/spatial_models/structural_bfls.py | 2 +- 4 files changed, 68 insertions(+), 114 deletions(-) diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index 1eef9997d7..98b7576b1c 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -12,7 +12,6 @@ #autoindent from os import mkdir, getcwd, path -import pickle from numpy import array from scipy import stats @@ -39,27 +38,21 @@ # set various parameters subj_id = ['%04d' % i for i in range(12)] -theta = float(stats.t.isf(0.01, 100)) -dmax = 4. -ths = 0 -thq = 0.95 -verbose = 1 +threshold = float(stats.t.isf(0.01, 100)) +sigma = 4. +prevalence_threshold = 0 +prevalence_pval = 0.95 smin = 5 write_dir = path.join(getcwd(), 'results') if not path.exists(write_dir): mkdir(write_dir) + method = 'quick' print('method used:', method) # call the function -AF, BF = make_bsa_image(mask_images, betas, theta, dmax, ths, thq, smin, - write_dir, method, subj_id, '%04d' % nbeta, - reshuffle=False) - -# Write the result. OK, this is only a temporary solution -picname = path.join(write_dir, "AF_%04d.pic" % nbeta) -pickle.dump(AF, open(picname, 'wb'), 2) -picname = path.join(write_dir, "BF_%04d.pic" % nbeta) -pickle.dump(BF, open(picname, 'wb'), 2) +landmarks, individual_rois = make_bsa_image( + mask_images, betas, threshold, smin, sigma, prevalence_threshold, + prevalence_pval, write_dir, method, '%04d' % nbeta) print("Wrote all the results in directory %s" % write_dir) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 2bd586835e..2882c96fdd 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -173,8 +173,12 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, learning_set = np.squeeze(stats_[stats_ != 0]) prior_h0.append(_signal_to_pproba(mean_val, learning_set, method)) subjects.append(subject * np.ones(mean_val.size).astype(np.int)) - + else: + subjects.append([]) + prior_h0.append([]) + coords.append(np.empty((0, domain.dim))) hrois.append(hroi) + prior_h0 = np.concatenate(prior_h0) subjects = np.concatenate(subjects) coords = np.concatenate(coords) diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 5bfeb983f2..bafa072e62 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -15,10 +15,9 @@ def make_bsa_image( - mask_images, stat_images, threshold=3., sigma=5., prevalence_threshold=0, - prevalence_pval=0.5, smin=0, write_dir=None, method='simple', - subjects_id=None, contrast_id='default', dens_path=None, cr_path=None, - verbose=0): + mask_images, stat_images, threshold=3., smin=0, sigma=5., + prevalence_threshold=0, prevalence_pval=0.5, write_dir=None, + method='simple', contrast_id='default', verbose=0): """ Main function for performing bsa on a set of images. It creates the some output images in the given directory @@ -26,12 +25,12 @@ def make_bsa_image( ---------- mask_images: A list of image paths that yield binary images, one for each subject - the number os subjects, n_subjects, is taken as len(mask_images) stat_images: A list of image paths that yields the activation images, one for each subject - threshold=3., threshold used to ignore all the image data that si below - sigma=5., prior width of the spatial model - corresponds to multi-subject uncertainty + threshold: float, optional, + threshold used to ignore all the image data that si below + sigma: float, optional + variance of the spatial model, i.e. cross-subject uncertainty prevalence_threshold: float, optional threshold on the representativity measure prevalence_pval: float, optional @@ -44,16 +43,8 @@ def make_bsa_image( if not None, output directory method: string, one of ['simple', 'quick'], optional, applied region detection method; to be chose among - subjects_id=None: list of strings, identifiers of the subjects. - by default it is range(n_subjects) - contrast_id='default', string, identifier of the contrast - dens_path=None, string, path of the output density image - if False, no image is written - if None, the path is join(write_dir, density_contrast_id.nii) - cr_path=None, string, path of the (4D) output label image - if False, no image is written - if None, many images are written, - with paths computed from write_dir, subjects_id and contrast_id + contrast_id: string, optional, + identifier of the contrast Returns ------- @@ -68,13 +59,7 @@ def make_bsa_image( ===== unique mask should be allowed """ - # Sanity check - if len(mask_images) != len(stat_images): - raise ValueError("the number of masks and activation images" \ - "should be the same") - n_subjects = len(mask_images) - if subjects_id == None: - subjects_id = [str(subject) for subject in range(n_subjects)] + n_subjects = len(stat_images) # Read the referential information nim = load(mask_images[0]) @@ -89,12 +74,12 @@ def make_bsa_image( nvox = domain.size # read the functional images - lbeta = [] + stats = [] for subject in range(n_subjects): rbeta = load(stat_images[subject]) beta = np.reshape(rbeta.get_data(), ref_dim) - lbeta.append(beta[mask > 0]) - lbeta = np.array(lbeta).T + stats.append(beta[mask > 0]) + stats = np.array(stats).T # launch the method crmap = np.zeros(nvox) @@ -104,87 +89,59 @@ def make_bsa_image( if method == 'simple': crmap, landmarks, hrois, density = compute_landmarks( - domain, lbeta, sigma, prevalence_pval, prevalence_threshold, + domain, stats, sigma, prevalence_pval, prevalence_threshold, threshold, smin, algorithm='standard', verbose=verbose) if method == 'quick': crmap, landmarks, hrois, co_clust = compute_landmarks( - domain, lbeta, sigma, prevalence_pval, prevalence_threshold, + domain, stats, sigma, prevalence_pval, prevalence_threshold, threshold, smin, algorithm='quick', verbose=verbose) density = np.zeros(nvox) crmap = landmarks.map_label(domain.coord, 0.95, sigma) - # Write the results as images - # the spatial density image - if dens_path is not False: - density_map = np.zeros(ref_dim) - density_map[mask > 0] = density - wim = Nifti1Image(density_map, affine) - wim.get_header()['descrip'] = 'group-level spatial density \ - of active regions' - if dens_path == None: - dens_path = op.join(write_dir, "density_%s.nii" % contrast_id) - save(wim, dens_path) - - if cr_path == False: + if write_dir == False: return landmarks, hrois - default_idx = landmarks.k + 2 + # Write the results as images - if cr_path == None and write_dir == None: - return landmarks, hrois + # the spatial density image + density_map = np.zeros(ref_dim) + density_map[mask > 0] = density + wim = Nifti1Image(density_map, affine) + wim.get_header()['descrip'] = 'group-level spatial density\ + of active regions' + dens_path = op.join(write_dir, "density_%s.nii" % contrast_id) + save(wim, dens_path) - if cr_path == None: - # write a 3D image for group-level labels - cr_path = op.join(write_dir, "CR_%s.nii" % contrast_id) - labels = - 2 * np.ones(ref_dim) - labels[mask > 0] = crmap - wim = Nifti1Image(labels.astype('int16'), affine) - wim.get_header()['descrip'] = 'group Level labels from bsa procedure' - save(wim, cr_path) - - # write a prevalence image - cr_path = op.join(write_dir, "prevalence_%s.nii" % contrast_id) - prevalence_map = np.zeros(ref_dim) - prevalence_map[mask > 0] = landmarks.prevalence_density() - wim = Nifti1Image(prevalence_map, affine) - wim.get_header()['descrip'] = 'Weighted prevalence image' - save(wim, cr_path) - - # write 3d images for the subjects - for subject in range(n_subjects): - label_image = op.join(write_dir, "AR_s%s_%s.nii" % ( - subjects_id[subject], contrast_id)) - labels = - 2 * np.ones(ref_dim) - labels[mask > 0] = -1 - if hrois[subject] is not None: - nls = hrois[subject].get_roi_feature('label').astype(np.int) - nls[nls == - 1] = default_idx - lab = hrois[subject].label - lab[lab > - 1] = nls[lab[lab > - 1]] - labels[mask > 0] = lab - - wim = Nifti1Image(labels.astype('int16'), affine) - wim.get_header()['descrip'] = \ - 'Individual label image from bsa procedure' - save(wim, label_image) - else: - # write everything in a single 4D image - wdim = (ref_dim[0], ref_dim[1], ref_dim[2], n_subjects + 1) - labels = - 2 * np.ones(wdim, 'int16') - labels[mask > 0, 0] = crmap - for subject in range(n_subjects): - labels[mask > 0, subject + 1] = - 1 - if hrois[s] is not None: - nls = hrois[subject].get_roi_feature('label') - nls[nls == - 1] = default_idx - lab = hrois[subject].label - lab[lab > - 1] = nls[lab[lab > - 1]] - labels[mask > 0, subject + 1] = lab - wim = Nifti1Image(labels, affine) - wim.get_header()['descrip'] = 'group Level and individual labels\ - from bsa procedure' - save(wim, cr_path) + default_idx = landmarks.k + 2 + # write a 3D image for group-level labels + labels = - 2 * np.ones(ref_dim) + labels[mask > 0] = crmap + wim = Nifti1Image(labels.astype('int16'), affine) + wim.get_header()['descrip'] = 'group Level labels from bsa procedure' + save(wim, op.join(write_dir, "CR_%s.nii" % contrast_id)) + + # write a prevalence image + prevalence_map = np.zeros(ref_dim) + prevalence_map[mask > 0] = landmarks.prevalence_density() + wim = Nifti1Image(prevalence_map, affine) + wim.get_header()['descrip'] = 'Weighted prevalence image' + save(wim, op.join(write_dir, "prevalence_%s.nii" % contrast_id)) + + # write a 4d images with all subjects results + wdim = (ref_dim[0], ref_dim[1], ref_dim[2], n_subjects) + labels = - 2 * np.ones(wdim, 'int16') + for subject in range(n_subjects): + labels[mask > 0, subject] = - 1 + if hrois[s] is not None: + nls = hrois[subject].get_roi_feature('label') + nls[nls == - 1] = default_idx + lab = hrois[subject].label + lab[lab > - 1] = nls[lab[lab > - 1]] + labels[mask > 0, subject] = lab + wim = Nifti1Image(labels, affine) + wim.get_header()['descrip'] = 'Individual labels from bsa procedure' + save(wim, op.join(write_dir, "AR_%s.nii" % contrast_id)) return landmarks, hrois diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index 8ee4f6abb4..093b85b5e6 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -383,7 +383,7 @@ def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, for s in range(n_subjects)]) labels = np.concatenate([hrois[s].get_roi_feature('label') for s in range(n_subjects)if hrois[s].k > 0]) - labels = np.squeeze(labels) + # labels = np.squeeze(labels) if 'prior_proba' in hrois[0].roi_features: conf = np.concatenate([hrois[s].get_roi_feature('prior_proba') for s in range(n_subjects)if hrois[s].k > 0]) From 132e32b2064af24fbf5c7a416fd4e9aa6736bd59 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sun, 7 Apr 2013 23:29:58 +0200 Subject: [PATCH 143/164] Proceed with updates of the Functional landmark stuff --- .../need_data/bayesian_structural_analysis.py | 2 +- nipy/labs/spatial_models/structural_bfls.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index 98b7576b1c..1b2ad4f66a 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -40,7 +40,7 @@ subj_id = ['%04d' % i for i in range(12)] threshold = float(stats.t.isf(0.01, 100)) sigma = 4. -prevalence_threshold = 0 +prevalence_threshold = 2 prevalence_pval = 0.95 smin = 5 write_dir = path.join(getcwd(), 'results') diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index 093b85b5e6..76bd8190ce 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -375,10 +375,10 @@ def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, which discards labels that do not fulfill the condition (c) """ - dim = hrois[0].domain.em_dim - + # dim = hrois[0].domain.em_dim + # prepare various variables to ease information manipulation - n_subjects = np.size(hrois) + n_subjects = len(hrois) subjects = np.concatenate([s * np.ones(hrois[s].k, np.int) for s in range(n_subjects)]) labels = np.concatenate([hrois[s].get_roi_feature('label') @@ -416,11 +416,14 @@ def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, if (stats.norm.sf(prevalence_threshold, mp, np.sqrt(vp)) > prevalence_pval): sj = np.size(subjj) - coord = np.zeros((sj, dim)) - for (k, s, a) in zip(intrasubj[labels == i], subjects[labels == i], - range(sj)): - coord[a] = hrois[s].get_roi_feature('position')[k] - + # coord = np.zeros((sj, dim)) + #for (k, s, a) in zip(intrasubj[labels == i], subjects[labels == i], + # range(sj)): + # coord[a] = hrois[s].get_roi_feature('position')[k] + coord = np.vstack([ + hrois[s].get_roi_feature('position')[k] + for (k, s, a) in zip(intrasubj[labels == i], + subjects[labels == i], range(sj))]) valid[i] = 1 coords.append(coord) subjs.append(subjj) From 434799d1f1ec1c8031cd87c32e3b609049ed616f Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 13 Apr 2013 13:40:29 -0700 Subject: [PATCH 144/164] NF: add script to build dmg files from buildbots The buildbots build mpkgs; this script builds dmgs from the mpkgs and sets the permissions correctly. --- tools/build_dmgs.py | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 tools/build_dmgs.py diff --git a/tools/build_dmgs.py b/tools/build_dmgs.py new file mode 100755 index 0000000000..d4186d8d38 --- /dev/null +++ b/tools/build_dmgs.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +"""Script to build dmgs for buildbot builds + +Example +------- +%(prog)s "dipy-dist/dipy*-0.6.0-py*mpkg" + +Note quotes around the globber first argument to protect it from shell +globbing. + +""" +import os +from os.path import join as pjoin, isfile, isdir +import sys +import shutil +from glob import glob +from functools import partial +from subprocess import check_call +import warnings + +from argparse import ArgumentParser, RawDescriptionHelpFormatter + +my_call = partial(check_call, shell=True) + +BUILDBOT_LOGIN = "buildbot@nipy.bic.berkeley.edu" +BUILDBOT_HTML = "nibotmi/public_html/" + +def main(): + parser = ArgumentParser(description=__doc__, + formatter_class=RawDescriptionHelpFormatter) + parser.add_argument('globber', type=str, + help='glob to serch for build mpkgs') + parser.add_argument('--out-path', type=str, default='mpkg-dist', + help='path for output files (default="mpkg-dist")', + metavar='OUTPATH') + parser.add_argument('--clobber', action='store_true', + help='Delete OUTPATH if exists') + args = parser.parse_args() + globber = args.globber + out_path = args.out_path + address = "{0}:{1}{2}".format(BUILDBOT_LOGIN, BUILDBOT_HTML, globber) + if isdir(out_path): + if not args.clobber: + raise RuntimeError('Path {0} exists and "clobber" not set'.format( + out_path)) + shutil.rmtree(out_path) + os.mkdir(out_path) + cwd = os.path.abspath(os.getcwd()) + os.chdir(out_path) + try: + my_call('scp -r {0} .'.format(address)) + found_mpkgs = sorted(glob('*.mpkg')) + for mpkg in found_mpkgs: + pkg_name, ext = os.path.splitext(mpkg) + assert ext == '.mpkg' + my_call('sudo reown_mpkg {0} root admin'.format(mpkg)) + os.mkdir(pkg_name) + pkg_moved = pjoin(pkg_name, mpkg) + os.rename(mpkg, pkg_moved) + readme = pjoin(pkg_moved, 'Contents', 'Resources', 'ReadMe.txt') + if isfile(readme): + shutil.copy(readme, pkg_name) + else: + warnings.warn("Could not find readme with " + readme) + my_call('sudo hdiutil create {0}.dmg -srcfolder ./{0}/ -ov'.format(pkg_name)) + finally: + os.chdir(cwd) + + +if __name__ == '__main__': + main() From e68c7b5eeecb28cbddba97a10bcb14d3c3bd8a62 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Sat, 13 Apr 2013 14:01:24 -0700 Subject: [PATCH 145/164] NF: add tool for doctest for extensions Fetched from the dipy/tools directory. --- tools/doctest_extmods.py | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100755 tools/doctest_extmods.py diff --git a/tools/doctest_extmods.py b/tools/doctest_extmods.py new file mode 100755 index 0000000000..2ca439321f --- /dev/null +++ b/tools/doctest_extmods.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +"""Run doctests in extension modules of + +Collect extension modules in + +Run doctests in each extension module + +Example: + + %prog dipy +""" + +import sys +import os +from os.path import dirname, relpath, sep, join as pjoin, splitext, abspath + +from distutils.sysconfig import get_config_vars + +import doctest +from optparse import OptionParser + +EXT_EXT = get_config_vars('SO')[0] + + +def get_ext_modules(pkg_name): + pkg = __import__(pkg_name, fromlist=['']) + pkg_dir = abspath(dirname(pkg.__file__)) + # pkg_root = __import__(pkg_name) + ext_modules = [] + for dirpath, dirnames, filenames in os.walk(pkg_dir): + reldir = relpath(dirpath, pkg_dir) + if reldir == '.': + reldir = '' + for filename in filenames: + froot, ext = splitext(filename) + if ext == EXT_EXT: + mod_path = pjoin(reldir, froot) + mod_uri = pkg_name + '.' + mod_path.replace(sep, '.') + # fromlist=[''] results in submodule being returned, rather than the + # top level module. See help(__import__) + mod = __import__(mod_uri, fromlist=['']) + ext_modules.append(mod) + return ext_modules + + +def main(): + usage = "usage: %prog [options] \n\n" + __doc__ + parser = OptionParser(usage=usage) + opts, args = parser.parse_args() + if len(args) == 0: + parser.print_help() + sys.exit(1) + mod_name = args[0] + mods = get_ext_modules(mod_name) + for mod in mods: + print("Testing module: " + mod.__name__) + doctest.testmod(mod) + + +if __name__ == '__main__': + main() From c594ac872933bbb468cdbe37976425005ab3a15a Mon Sep 17 00:00:00 2001 From: bthirion Date: Fri, 19 Apr 2013 23:43:46 +0200 Subject: [PATCH 146/164] Further simplifications on the landmark learning structure --- .../bayesian_structural_analysis.py | 28 ++- nipy/labs/spatial_models/bsa_io.py | 24 +-- nipy/labs/spatial_models/structural_bfls.py | 192 ++++-------------- 3 files changed, 74 insertions(+), 170 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 2882c96fdd..7b797246fa 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -277,6 +277,7 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, _, label = Fbeta.custom_watershed(0, null_density) # append some information to the hroi in each subject + components = [] for subject in range(n_subjects): bfs = hrois[subject] if bfs.k > 0: @@ -300,18 +301,27 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, roi_label = - np.ones(bfs.k).astype(np.int) j = label[midx] roi_label[leaves_pos] = j[leaves_pos] - + components.append(j[leaves_pos]) + # when parent regions has similarly labelled children, # include it also roi_label = bfs.make_forest().propagate_upward(roi_label) bfs.set_roi_feature('label', roi_label) - + # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one landmarks, new_values = build_landmarks( - hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) + domain, coords, subjects, np.array(components), 1 - prior_h0, + prevalence_pval, prevalence_threshold, sigma, verbose=verbose) + # relabel the regions + for subject in range(n_subjects): + if hrois[subject].k > 0: + us = hrois[subject].get_roi_feature('label') + us[us > - 1] = new_values[us[us > - 1]] + hrois[subject].set_roi_feature('label', us) + # make a group-level map of the landmark position label_map = _relabel(label, new_values) return label_map, landmarks, hrois, density @@ -410,8 +420,16 @@ def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - landmarks, _ = build_landmarks( - hrois, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) + landmarks, new_values = build_landmarks( + domain, coords, subjects, components, 1 - prior_h0, + prevalence_pval, prevalence_threshold, sigma, verbose=verbose) + + # relabel the regions + for subject in range(n_subjects): + if hrois[subject].k > 0: + us = hrois[subject].get_roi_feature('label') + us[us > - 1] = new_values[us[us > - 1]] + hrois[subject].set_roi_feature('label', us) # make a group-level map of the landmark position label_map = - np.ones(domain.size) diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index bafa072e62..864d4fb6cd 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -71,21 +71,20 @@ def make_bsa_image( # encode it as a domain domain = domain_from_image(Nifti1Image(mask, affine), nn=18) - nvox = domain.size + n_voxels = domain.size # read the functional images stats = [] - for subject in range(n_subjects): - rbeta = load(stat_images[subject]) - beta = np.reshape(rbeta.get_data(), ref_dim) + for stat_image in stat_images: + beta = np.reshape(load(stat_image).get_data(), ref_dim) stats.append(beta[mask > 0]) stats = np.array(stats).T # launch the method - crmap = np.zeros(nvox) - density = np.zeros(nvox) + crmap = np.zeros(n_voxels).astype(np.int16) + density = np.zeros(n_voxels) landmarks = None - hrois = [None for s in range(n_subjects)] + hrois = [None for _ in range(n_subjects)] if method == 'simple': crmap, landmarks, hrois, density = compute_landmarks( @@ -96,8 +95,6 @@ def make_bsa_image( crmap, landmarks, hrois, co_clust = compute_landmarks( domain, stats, sigma, prevalence_pval, prevalence_threshold, threshold, smin, algorithm='quick', verbose=verbose) - - density = np.zeros(nvox) crmap = landmarks.map_label(domain.coord, 0.95, sigma) if write_dir == False: @@ -124,8 +121,11 @@ def make_bsa_image( save(wim, op.join(write_dir, "CR_%s.nii" % contrast_id)) # write a prevalence image - prevalence_map = np.zeros(ref_dim) - prevalence_map[mask > 0] = landmarks.prevalence_density() + prev_ = np.zeros_like(crmap) + prev_[crmap > -1] = landmarks.roi_prevalence()[(crmap[crmap > -1]).\ + astype(np.int)] + prevalence_map = - np.ones(ref_dim) + prevalence_map[mask > 0] = prev_ wim = Nifti1Image(prevalence_map, affine) wim.get_header()['descrip'] = 'Weighted prevalence image' save(wim, op.join(write_dir, "prevalence_%s.nii" % contrast_id)) @@ -135,7 +135,7 @@ def make_bsa_image( labels = - 2 * np.ones(wdim, 'int16') for subject in range(n_subjects): labels[mask > 0, subject] = - 1 - if hrois[s] is not None: + if hrois[subject] is not None: nls = hrois[subject].get_roi_feature('label') nls[nls == - 1] = default_idx lab = hrois[subject].label diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index 76bd8190ce..bf285cdfb7 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -66,23 +66,6 @@ def centers(self): centers = np.array([np.mean(pos[k], 0) for k in range(self.k)]) return centers - def homogeneity(self): - """ returns the mean distance between points within each LR - """ - from ...algorithms.utils.fast_distance import euclidean_distance - - coord = self.get_feature('position') - h = np.zeros(self.k) - for k in range(self.k): - pk = coord[k] - sk = pk.shape[0] - if sk < 2: - h[k] = 0 - else: - edk = euclidean_distance(pk) - h[k] = edk.sum() / (sk * (sk - 1)) - return h - def density(self, k, coord=None, dmax=1., dof=10): """Posterior density of component k @@ -239,51 +222,6 @@ def show(self): for i in range(self.k): print i, prevalence[i], centers[i], np.unique(subjects[i]) - def roi_confidence(self, prevalence_threshold=0, fid='confidence'): - """ - assuming that a certain feature fid field has been set - as a discrete feature, - this creates an approximate p-value that states - how confident one might - that the LR is defined in at least prevalence_threshold individuals - if conficence is not defined as a discrete_feature, - it is assumed to be 1. - - Parameters - ---------- - prevalence_threshold: integer that yields the representativity threshold - - Returns - ------- - pvals: array of shape self.k - the p-values corresponding to the ROIs - """ - pvals = np.zeros(self.k) - subjects = self.get_feature('subjects') - if fid not in self.features: - # the feature has not been defined - print 'using per ROI subject counts' - for j in range(self.k): - pvals[j] = np.size(np.unique(subjects[j])) - pvals = pvals > prevalence_threshold +\ - 0.5 * (pvals == prevalence_threshold) - else: - for j in range(self.k): - subjj = subjects[j] - conf = self.get_feature(fid)[j] - mp = 0. - vp = 0. - for ls in np.unique(subjj): - lmj = 1 - np.prod(1 - conf[subjj == ls]) - lvj = lmj * (1 - lmj) - mp = mp + lmj - vp = vp + lvj - # If noise is too low the variance is 0: ill-defined: - vp = max(vp, 1e-14) - - pvals[j] = stats.norm.sf(prevalence_threshold, mp, np.sqrt(vp)) - return pvals - def roi_prevalence(self, fid='confidence'): """ assuming that fid='confidence' field has been set @@ -311,57 +249,28 @@ def roi_prevalence(self, fid='confidence'): confid[j] += lmj return confid - def weighted_feature_density(self, feature): - """ - Given a set of feature values, produce a weighted feature map, - where roi-levle features are mapped smoothly based on the density - of the components - - Parameters - ---------- - feature: array of shape (self.k), - the information to map - - Returns - ------- - wsm: array of shape(self.shape) - """ - if np.size(feature) != self.k: - raise ValueError('Incompatible feature dimension') - - cs = self.domain.coord - aux = np.zeros((cs.shape[0], self.k)) - for k in range(self.k): - aux[:, k], _ = self.density(k, cs) - - wsum = np.dot(aux, feature) - return wsum - - def prevalence_density(self): - """Returns a weighted map of self.prevalence - - Returns - ------- - wp: array of shape(n_samples) - """ - return self.weighted_feature_density(self.roi_prevalence()) - -def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, - dmax=1., verbose=0): +def build_landmarks(domain, coords, subjects, labels, confidence=None, + prevalence_pval=0.95, prevalence_threshold=0, dmax=1., + verbose=0): """ Given a list of hierarchical ROIs, and an associated labelling, this creates an Amer structure wuch groups ROIs with the same label. Parameters ---------- - hrois : list of nipy.labs.spatial_models.hroi.Nroi instances - it is assumd that each list corresponds to one subject - each HierarchicalROI is assumed to have the roi_features - 'position', 'label' and 'posterior_proba' defined - prevalence_pval=0.95, prevalence_threshold=0 defines the condition (c): - (c) A label should be present in prevalence_threshold subjects - with a probability>prevalence_pval + domain: discrete_domain.DiscreteDomain instance, + description of the spatial context of the landmarks + coords: array of shape(n, 3) + Sets of coordinates for the different objects + subjects: array of shape (n), dtype = np.int + indicators of the dataset the objects come from + labels: array of shape (n), dtype = np.int + index of the landmark the object is associated with + prevalence_pval: float, optional + prevalence_threshold: float, optional, + (c) A label should be present in prevalence_threshold + subjects with a probability>prevalence_pval in order to be valid dmax: float optional, regularizing constant that defines a prior on the region extent @@ -375,24 +284,12 @@ def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, which discards labels that do not fulfill the condition (c) """ - # dim = hrois[0].domain.em_dim - - # prepare various variables to ease information manipulation - n_subjects = len(hrois) - subjects = np.concatenate([s * np.ones(hrois[s].k, np.int) - for s in range(n_subjects)]) - labels = np.concatenate([hrois[s].get_roi_feature('label') - for s in range(n_subjects)if hrois[s].k > 0]) - # labels = np.squeeze(labels) - if 'prior_proba' in hrois[0].roi_features: - conf = np.concatenate([hrois[s].get_roi_feature('prior_proba') - for s in range(n_subjects)if hrois[s].k > 0]) - else: - conf = np.ones(labels.size) - intrasubj = np.concatenate([np.arange(hrois[s].k) - for s in range(n_subjects)]) - - coords = [] + if confidence is None: + confidence = np.ones(labels.size) + intrasubj = np.concatenate([np.arange(np.sum(subjects == s)) + for s in np.unique(subjects)]) + + coordinates = [] subjs = [] pps = [] n_labels = int(labels.max() + 1) @@ -400,46 +297,35 @@ def build_landmarks(hrois, prevalence_pval=0.95, prevalence_threshold=0, # do some computation to find which regions are worth reporting for i in np.unique(labels[labels > - 1]): - mp = 0. - vp = 0. - subjj = subjects[labels == i] - for ls in np.unique(subjj): - lmj = 1 - np.prod(1 - conf[(labels == i) * (subjects == ls)]) - lvj = lmj * (1 - lmj) - mp = mp + lmj - vp = vp + lvj + mean_c, var_c = 0., 0. + subjects_i = subjects[labels == i] + for subject_i in np.unique(subjects_i): + confidence_i = 1 - np.prod(1 - confidence[(labels == i) * + (subjects == subject_i)]) + mean_c += confidence_i + var_c += confidence_i * (1 - confidence_i) # If noise is too low the variance is 0: ill-defined: - vp = max(vp, 1e-14) + var_c = max(var_c, 1e-14) - # if above threshold, get some information to create the LR - if (stats.norm.sf(prevalence_threshold, mp, np.sqrt(vp)) > + # if above threshold, get some information to create the landmarks + if (stats.norm.sf(prevalence_threshold, mean_c, np.sqrt(var_c)) > prevalence_pval): - sj = np.size(subjj) - # coord = np.zeros((sj, dim)) - #for (k, s, a) in zip(intrasubj[labels == i], subjects[labels == i], - # range(sj)): - # coord[a] = hrois[s].get_roi_feature('position')[k] coord = np.vstack([ - hrois[s].get_roi_feature('position')[k] - for (k, s, a) in zip(intrasubj[labels == i], - subjects[labels == i], range(sj))]) + coords[subjects == s][k] for (k, s) in zip( + intrasubj[labels == i], + subjects[labels == i])]) valid[i] = 1 - coords.append(coord) - subjs.append(subjj) - pps.append(conf[labels == i]) + coordinates.append(coord) + subjs.append(subjects_i) + pps.append(confidence[labels == i]) # relabel the ROIs maplabel = - np.ones(n_labels).astype(np.int) maplabel[valid > 0] = np.cumsum(valid[valid > 0]) - 1 - for subject in range(n_subjects): - if hrois[subject].k > 0: - us = hrois[s].get_roi_feature('label') - us[us > - 1] = maplabel[us[us > - 1]] - hrois[subject].set_roi_feature('label', us) # create the landmark regions structure - k = np.sum(valid) - LR = LandmarkRegions(hrois[0].domain, k, indiv_coord=coords, subjects=subjs) + LR = LandmarkRegions(domain, np.sum(valid), indiv_coord=coordinates, + subjects=subjs) LR.set_feature('confidence', pps) return LR, maplabel From 00721646ea059f7102091cf5fbc37a26bda1ae64 Mon Sep 17 00:00:00 2001 From: bthirion Date: Sun, 21 Apr 2013 23:26:50 +0200 Subject: [PATCH 147/164] Simplified again the landmark API --- examples/labs/bayesian_structural_analysis.py | 80 +++++---- .../bayesian_structural_analysis.py | 41 ++--- nipy/labs/spatial_models/bsa_io.py | 19 +-- nipy/labs/spatial_models/structural_bfls.py | 156 +++++------------- nipy/labs/spatial_models/tests/test_bsa.py | 7 +- 5 files changed, 108 insertions(+), 195 deletions(-) diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index e23cc46224..cf1cb93979 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -58,11 +58,6 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, """ ref_dim = np.shape(betas[0]) n_subjects = betas.shape[0] - xyz = np.array(np.where(betas[:1])).T.astype(np.int) - - # Get coordinates in mm - xyz = xyz[:, 1:] # switch to dimension 2 - coord = xyz.astype(np.float) # get the functional information stats = np.array([np.ravel(betas[k]) for k in range(n_subjects)]).T @@ -71,18 +66,23 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, domain = domain_from_binary_array(np.ones(ref_dim)) if method == 'simple': - group_map, landmarks, hrois, likelihood = compute_landmarks( - domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, method='prior', - algorithm='standard') + algorithm = 'standard' elif method == 'quick': - likelihood = np.zeros(ref_dim) - group_map, landmarks, hrois, coclustering = compute_landmarks( - domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, method='prior', - algorithm='quick') + algorithm = 'quick' else: raise ValueError('method is not correctly defined') + + landmarks, hrois = compute_landmarks( + domain, stats, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, method='prior', algorithm=algorithm) + + if landmarks != None: + grp_map = landmarks.map_label(domain.coord, .8, sigma) + grp_map.shape = ref_dim + group_map = landmarks.map_label(domain.coord, 0.95, sigma) + density = landmarks.kernel_density(k=None, coord=domain.coord, + sigma=sigma) + group_map.shape = ref_dim if verbose == 0: return landmarks, hrois @@ -91,36 +91,10 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, lmax = landmarks.k + 2 landmarks.show() - group_map.shape = ref_dim - plt.figure(figsize=(8, 3)) - ax = plt.subplot(1, 3, 1) - plt.imshow(group_map, interpolation='nearest', vmin=-1, vmax=lmax) - plt.title('Blob separation map', fontsize=10) - plt.axis('off') - plt.colorbar(shrink=.8) - - if landmarks != None: - group_map = landmarks.map_label(coord, 0.95, sigma) - group_map.shape = ref_dim - - plt.subplot(1, 3, 2) - plt.imshow(group_map, interpolation='nearest', vmin=-1, vmax=lmax) - plt.title('group-level position 95% \n confidence regions', fontsize=10) - plt.axis('off') - plt.colorbar(shrink=.8) - - plt.subplot(1, 3, 3) - likelihood.shape = ref_dim - plt.imshow(likelihood, interpolation='nearest') - plt.title('Spatial density under h1', fontsize=10) - plt.axis('off') - plt.colorbar(shrink=.8) - - fig_output = plt.figure(figsize=(8, 3.5)) fig_output.text(.5, .9, "Individual landmark regions", ha="center") for s in range(n_subjects): - ax = plt.subplot(n_subjects / 5, 5, s + 1) + plt.subplot(n_subjects / 5, 5, s + 1) #ax.set_position([.02, .02, .96, .96]) lw = - np.ones(ref_dim) if hrois[s] is not None: @@ -139,6 +113,30 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, plt.imshow(betas[s], interpolation='nearest', vmin=betas.min(), vmax=betas.max()) plt.axis('off') + + if landmarks is None: + return landmarks, hrois + plt.figure(figsize=(8, 3)) + + plt.subplot(1, 3, 1) + plt.imshow(group_map, interpolation='nearest', vmin=-1, vmax=lmax) + plt.title('Blob separation map', fontsize=10) + plt.axis('off') + plt.colorbar(shrink=.8) + + plt.subplot(1, 3, 2) + plt.imshow(grp_map, interpolation='nearest', vmin=-1, vmax=lmax) + plt.title('group-level position 80% \n confidence regions', fontsize=10) + plt.axis('off') + plt.colorbar(shrink=.8) + + plt.subplot(1, 3, 3) + density.shape = ref_dim + plt.imshow(density, interpolation='nearest') + plt.title('Spatial density under h1', fontsize=10) + plt.axis('off') + plt.colorbar(shrink=.8) + return landmarks, hrois diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 7b797246fa..ba4f0cfcbb 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -311,22 +311,27 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - landmarks, new_values = build_landmarks( + landmarks, new_labels = build_landmarks( domain, coords, subjects, np.array(components), 1 - prior_h0, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # relabel the regions - for subject in range(n_subjects): - if hrois[subject].k > 0: - us = hrois[subject].get_roi_feature('label') - us[us > - 1] = new_values[us[us > - 1]] - hrois[subject].set_roi_feature('label', us) + _update_hroi_labels(hrois, new_labels) # make a group-level map of the landmark position - label_map = _relabel(label, new_values) + label_map = _relabel(label, new_labels) return label_map, landmarks, hrois, density +def _update_hroi_labels(hrois, new_labels): + """Update the labels of the hroisusing new_labels""" + for subject in range(len(hrois)): + if hrois[subject].k > 0: + us = hrois[subject].get_roi_feature('label') + us[us > - 1] = new_labels[us[us > - 1]] + hrois[subject].set_roi_feature('label', us) + + def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, verbose=False): @@ -420,16 +425,12 @@ def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one - landmarks, new_values = build_landmarks( + landmarks, new_labels = build_landmarks( domain, coords, subjects, components, 1 - prior_h0, prevalence_pval, prevalence_threshold, sigma, verbose=verbose) # relabel the regions - for subject in range(n_subjects): - if hrois[subject].k > 0: - us = hrois[subject].get_roi_feature('label') - us[us > - 1] = new_values[us[us > - 1]] - hrois[subject].set_roi_feature('label', us) + _update_hroi_labels(hrois, new_labels) # make a group-level map of the landmark position label_map = - np.ones(domain.size) @@ -469,22 +470,11 @@ def compute_landmarks( Returns ------- - label_map: array of shape (nnodes): - the resulting group-level labelling of the space landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found in inter-subject inference If no such thing can be defined landmarks is set to None hrois: List of nipy.labs.spatial_models.hroi.Nroi instances representing individual ROIs - density: array of shape (nnodes): - likelihood of the data under H1 over some sampling grid - - Notes - ----- - In that case, the DPMM is used to derive a spatial density of - significant local maxima in the volume. Each terminal (leaf) - region which is a posteriori significant enough is assigned to the - nearest mode of this distribution """ hrois, prior_h0, subjects, coords = _compute_individual_regions( domain, stats, threshold, smin, method, verbose) @@ -493,11 +483,10 @@ def compute_landmarks( label_map, landmarks, hrois, density = bsa_dpmm( hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prevalence_threshold, verbose=verbose) - return label_map, landmarks, hrois, density elif algorithm == 'quick': label_map, landmarks, hrois, co_clust = bsa_dpmm2( hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prevalence_threshold, verbose=verbose) - return label_map, landmarks, hrois, co_clust else: raise ValueError('Unknown method') + return landmarks, hrois diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 864d4fb6cd..2e76332274 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -87,16 +87,15 @@ def make_bsa_image( hrois = [None for _ in range(n_subjects)] if method == 'simple': - crmap, landmarks, hrois, density = compute_landmarks( - domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, algorithm='standard', verbose=verbose) - - if method == 'quick': - crmap, landmarks, hrois, co_clust = compute_landmarks( - domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, algorithm='quick', verbose=verbose) - crmap = landmarks.map_label(domain.coord, 0.95, sigma) - + algorithm = 'standard' + else: + algorithm = 'quick' + + landmarks, hrois = compute_landmarks( + domain, stats, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, algorithm=algorithm, verbose=verbose) + crmap = landmarks.map_label(domain.coord, 0.95, sigma) + density = landmarks.kernel_density(k=None, coord=domain.coord, sigma=sigma) if write_dir == False: return landmarks, hrois diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index bf285cdfb7..cc7695f256 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -10,7 +10,7 @@ Data Revisited: Improving the Sensitivity and Reliability of fMRI Group Studies. IEEE TMI 2007 -Author : Bertrand Thirion, 2006-2010 +Author : Bertrand Thirion, 2006-2013 """ #autoindent @@ -19,6 +19,18 @@ from scipy import stats +def _threshold_weight_map(x, fraction): + """threshold a positive map in order to retain a certain fraction of the + total value""" + sorted_x = - np.sort(- x) + if fraction < sorted_x[0] / x.sum(): + return np.zeros_like(x) + + idx = np.where(np.cumsum(sorted_x) < fraction * x.sum())[0][-1] + x[x < sorted_x[idx]] = 0 + return x + + class LandmarkRegions(object): """ This class is intended to represent a set of inter-subject regions @@ -66,124 +78,41 @@ def centers(self): centers = np.array([np.mean(pos[k], 0) for k in range(self.k)]) return centers - def density(self, k, coord=None, dmax=1., dof=10): - """Posterior density of component k - + def kernel_density(self, k=None, coord=None, sigma=1.): + """ Compute the density of a component as a kde + Parameters ---------- - k: int, less or equal to self.k - reference component + k: int (<= self.k) or None + component upon which the density is computed + if None, the sum is taken over k coord: array of shape(n, self.dom.em_dim), optional a set of input coordinates - dmax: float, optional - regularizaing constant for the variance estimation - dof: float, optional, - strength of the regularization - + sigma: float, optional + kernel size + Returns ------- - pd: array of shape(n) - the posterior density that has been computed - delta: array of shape(n) - the quadratic term in the gaussian model - - Fixme - ----- - instead of dof/dmax, use Raftery's regularization + kde: array of shape(n) + the density sampled at the coords """ - from scipy.linalg import svd - - if k > self.k: - raise ValueError('wrong region index') - - pos = self.get_feature('position')[k] - center = pos.mean(0) - dim = self.domain.em_dim - + from nipy.algorithms.utils.fast_distance import euclidean_distance if coord == None: coord = self.domain.coord + if k == None: + kde = np.zeros(coord.shape[0]) + for k in range(self.k): + pos = self.get_feature('position')[k] + dist = euclidean_distance(pos, coord) + kde += np.exp( - dist ** 2 / (2 * sigma ** 2)).sum(0) + else: + k = int(k) + pos = self.get_feature('position')[k] + dist = euclidean_distance(pos, coord) + kde = np.exp( - dist ** 2 / (2 * sigma ** 2)).sum(0) + return kde / (2 * np.pi * sigma ** 2) ** (pos.shape[1] / 2) - if coord.shape[1] != dim: - raise ValueError("incompatible dimensions") - - n_points = pos.shape[0] - dx = pos - center - covariance = np.dot(dx.T, dx) / n_points - U, S, V = svd(covariance, 0) - S = (n_points * S + dmax ** 2 * np.ones(dim) * dof) / (n_points + dof) - sqrts = 1. / np.sqrt(S) - dx = coord - center - dx = np.dot(dx, U) - dx = np.dot(dx, np.diag(sqrts)) - delta = np.sum(dx ** 2, 1) - lcst = - np.log(2 * np.pi) * dim / 2 + (np.log(sqrts)).sum() - pd = np.exp(lcst - delta / 2) - return pd, delta - - def hpd(self, k, coord=None, pval=0.95, dmax=1.0): - """Sample the posterior probability of being in k - on a grid defined by cs, assuming that the roi is an ellipsoid - - Parameters - ---------- - k: int, less or equal to self.k - reference component - coord: array of shape(n,dim), optional - a set of input coordinates - pval: float<1, optional, - cutoff for the CR - dmax=1.0: an upper bound for the spatial variance - to avoid degenerate variance - - Returns - ------- - hpd array of shape(n) that yields the value - """ - hpd, delta = self.density(k, coord, dmax) - - import scipy.special as sp - gamma = 2 * sp.erfinv(pval) ** 2 - # - #--- all the following is to solve the equation - #--- erf(x/sqrt(2))-x*exp(-x**2/2)/sqrt(pi/2) = alpha - #--- should better be put elsewhere - - def dicho_solve_lfunc(alpha, eps=1.e-7): - if alpha > 1: - raise ValueError("no solution for alpha>1") - if alpha > 1 - 1.e-15: - return np.inf - if alpha < 0: - raise ValueError("no solution for alpha<0") - if alpha < 1.e-15: - return 0 - - xmin = sp.erfinv(alpha) * np.sqrt(2) - xmax = 2 * xmin - while lfunc(xmax) < alpha: - xmax *= 2 - xmin *= 2 - return (dichomain_lfunc(xmin, xmax, eps, alpha)) - - def dichomain_lfunc(xmin, xmax, eps, alpha): - x = (xmin + xmax) / 2 - if xmax < xmin + eps: - return x - else: - if lfunc(x) > alpha: - return dichomain_lfunc(xmin, x, eps, alpha) - else: - return dichomain_lfunc(x, xmax, eps, alpha) - - def lfunc(x): - return sp.erf(x / np.sqrt(2)) - x * np.exp(-x ** 2 / 2) / \ - np.sqrt(np.pi / 2) - - gamma = dicho_solve_lfunc(pval) ** 2 - hpd[delta > gamma] = 0 - return hpd - - def map_label(self, coord=None, pval=0.95, dmax=1.): + def map_label(self, coord=None, pval=1., dmax=1.): """Sample the set of landmark regions on the proposed coordiante set cs, assuming a Gaussian shape @@ -203,11 +132,14 @@ def map_label(self, coord=None, pval=0.95, dmax=1.): if coord == None: coord = self.domain.coord label = - np.ones(coord.shape[0]) + null_density = 1. / self.domain.local_volume.sum() if self.k > 0: - aux = - np.ones((coord.shape[0], self.k)) + aux = - np.zeros((coord.shape[0], self.k)) for k in range(self.k): - aux[:, k] = self.hpd(k, coord, pval, dmax) - + kde = self.kernel_density(k, coord, dmax) + aux[:, k] = _threshold_weight_map(kde, pval) + + aux[aux < null_density] = 0 maux = np.max(aux, 1) label[maux > 0] = np.argmax(aux, 1)[maux > 0] return label diff --git a/nipy/labs/spatial_models/tests/test_bsa.py b/nipy/labs/spatial_models/tests/test_bsa.py index a4066a40d7..87b0af0073 100644 --- a/nipy/labs/spatial_models/tests/test_bsa.py +++ b/nipy/labs/spatial_models/tests/test_bsa.py @@ -27,20 +27,15 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, """ ref_dim = np.shape(betas[0]) n_subj = betas.shape[0] - xyz = np.array(np.where(betas[:1])).T - nvox = np.size(xyz, 0) # get the functional information lbeta = np.array([np.ravel(betas[k]) for k in range(n_subj)]).T # the voxel volume is 1.0 - g0 = 1.0 / (1.0 * nvox) - bdensity = 1 dom = domain_from_binary_array(np.ones(ref_dim)) if method == 'simple': - group_map, AF, BF, likelihood = \ - compute_landmarks(dom, lbeta, dmax, thq, ths, theta, smin) + AF, BF = compute_landmarks(dom, lbeta, dmax, thq, ths, theta, smin) return AF, BF From 6e852b1ac7f1a8337ecd916a2c1e9add7443990d Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 24 Apr 2013 15:40:55 -0700 Subject: [PATCH 148/164] DOC: tiny changes in release notes That I missed somehow. --- doc/devel/guidelines/make_release.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/devel/guidelines/make_release.rst b/doc/devel/guidelines/make_release.rst index 6c258307b0..4a8ed2ab45 100644 --- a/doc/devel/guidelines/make_release.rst +++ b/doc/devel/guidelines/make_release.rst @@ -27,7 +27,7 @@ is working and information parameters are set correctly. The second (``sdist-tests``) makes an sdist source distribution archive, installs it to a temporary directory, and runs the tests of that install. -If you have a version of nipy trunk past February 11th 2011, there will also +If you have a version of nibabel trunk past February 11th 2011, there will also be a functional make target:: make bdist-egg-tests @@ -55,7 +55,7 @@ Release checklist are as complete as possible and that every contributor was recognized. * Use the opportunity to update the ``.mailmap`` file if there are any duplicate - authors listed from ``git shortlog``. + authors listed from ``git shortlog -ns``. * Add any new authors to the ``AUTHORS`` file. Add any new entries to the ``THANKS`` file. From 86bb1b2fc274929673e0e5d69e106b01a13fcd02 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 24 Apr 2013 16:07:57 -0700 Subject: [PATCH 149/164] DOC: fix typo; change dipy to nipy From comments by Bertrand --- tools/build_dmgs.py | 6 ++---- tools/doctest_extmods.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/build_dmgs.py b/tools/build_dmgs.py index d4186d8d38..57aefd9c04 100755 --- a/tools/build_dmgs.py +++ b/tools/build_dmgs.py @@ -3,15 +3,13 @@ Example ------- -%(prog)s "dipy-dist/dipy*-0.6.0-py*mpkg" +%(prog)s "nipy-dist/nipy*-0.4.0-py*mpkg" Note quotes around the globber first argument to protect it from shell globbing. - """ import os from os.path import join as pjoin, isfile, isdir -import sys import shutil from glob import glob from functools import partial @@ -29,7 +27,7 @@ def main(): parser = ArgumentParser(description=__doc__, formatter_class=RawDescriptionHelpFormatter) parser.add_argument('globber', type=str, - help='glob to serch for build mpkgs') + help='glob to search for build mpkgs') parser.add_argument('--out-path', type=str, default='mpkg-dist', help='path for output files (default="mpkg-dist")', metavar='OUTPATH') diff --git a/tools/doctest_extmods.py b/tools/doctest_extmods.py index 2ca439321f..54eb6f2b86 100755 --- a/tools/doctest_extmods.py +++ b/tools/doctest_extmods.py @@ -7,7 +7,7 @@ Example: - %prog dipy + %prog nipy """ import sys From fb45a0693188a179b86b2c20ef787e572516a93d Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 25 Apr 2013 11:45:13 -0700 Subject: [PATCH 150/164] DOC: point to newer function for rolling axes We were pointing to the old deprecated function. --- nipy/core/image/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nipy/core/image/image.py b/nipy/core/image/image.py index b85018e0a2..274928acd1 100644 --- a/nipy/core/image/image.py +++ b/nipy/core/image/image.py @@ -5,7 +5,7 @@ * fromarray : create an Image instance from an ndarray (deprecated in favor of using the Image constructor) * subsample : slice an Image instance (deprecated in favor of image slicing) -* rollaxis : roll an image axis backwards +* rollimg : roll an image axis to given location * synchronized_order : match coordinate systems between images * iter_axis : make iterator to iterate over an image axis * is_image : test for an object obeying the Image API From 83eb4804013b3214cbcd2bebeaf97c5d72644fbe Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 25 Apr 2013 12:30:35 -0700 Subject: [PATCH 151/164] RF: add time and slice axes arguments to screens The ``screens`` utility assumed time last and slice second-to-last. Get screens to look for 't' axis (will nearly always be last, but often set), or accept suggestion from arguments; ditto for slice axis. --- nipy/algorithms/diagnostics/screens.py | 34 +++++++--- .../diagnostics/tests/test_screen.py | 63 ++++++++++++++++--- 2 files changed, 82 insertions(+), 15 deletions(-) diff --git a/nipy/algorithms/diagnostics/screens.py b/nipy/algorithms/diagnostics/screens.py index 989c382be8..feb68bd615 100644 --- a/nipy/algorithms/diagnostics/screens.py +++ b/nipy/algorithms/diagnostics/screens.py @@ -6,13 +6,14 @@ import numpy as np from ...core.api import Image, drop_io_dim, append_io_dim +from ...core.reference.coordinate_map import input_axis_index, AxisError from ...io.api import save_image from ..utils import pca from .timediff import time_slice_diffs from .tsdiffplot import plot_tsdiffs -def screen(img4d, ncomp=10): +def screen(img4d, ncomp=10, time_axis='t', slice_axis=None): ''' Diagnostic screen for 4d FMRI image Includes PCA, tsdiffana and mean, std, min, max images. @@ -23,6 +24,12 @@ def screen(img4d, ncomp=10): 4d image file ncomp : int, optional number of component images to return. Default is 10 + time_axis : str or int, optional + Axis over which to do PCA, time difference analysis. Defaults to `t` + slice_axis : None or str or int, optional + Name or index of input axis over which to do slice analysis for time + difference analysis. If None, look for input axis ``slice``, otherwise, + assume slice is the last non-time axis. Returns ------- @@ -52,23 +59,36 @@ def screen(img4d, ncomp=10): raise ValueError('Expecting a 4d image') data = img4d.get_data() cmap = img4d.coordmap + # Get numerical index for time axis in data array + time_axis = input_axis_index(cmap, time_axis) + # Get numerical index for slice axis in data array + if slice_axis is None: + try: + slice_axis = input_axis_index(cmap, 'slice') + except AxisError: + slice_axis = 2 if time_axis == 3 else 3 + else: + slice_axis = input_axis_index(cmap, slice_axis) + # 3D coordinate map for summary images cmap_3d = drop_io_dim(cmap, 't') screen_res = {} # standard processed images - screen_res['mean'] = Image(np.mean(data, axis=-1), cmap_3d) - screen_res['std'] = Image(np.std(data, axis=-1), cmap_3d) - screen_res['max'] = Image(np.max(data, axis=-1), cmap_3d) - screen_res['min'] = Image(np.min(data, axis=-1), cmap_3d) + screen_res['mean'] = Image(np.mean(data, axis=time_axis), cmap_3d) + screen_res['std'] = Image(np.std(data, axis=time_axis), cmap_3d) + screen_res['max'] = Image(np.max(data, axis=time_axis), cmap_3d) + screen_res['min'] = Image(np.min(data, axis=time_axis), cmap_3d) # PCA screen_res['pca_res'] = pca.pca(data, - axis=-1, + axis=time_axis, standardize=False, ncomp=ncomp) cmap_4d = append_io_dim(cmap_3d, 'l' , 't') screen_res['pca'] = Image(screen_res['pca_res']['basis_projections'], cmap_4d) # tsdiffana - screen_res['ts_res'] = time_slice_diffs(data) + screen_res['ts_res'] = time_slice_diffs(data, + time_axis=time_axis, + slice_axis=slice_axis) return screen_res diff --git a/nipy/algorithms/diagnostics/tests/test_screen.py b/nipy/algorithms/diagnostics/tests/test_screen.py index 2046c62974..99b32598f0 100644 --- a/nipy/algorithms/diagnostics/tests/test_screen.py +++ b/nipy/algorithms/diagnostics/tests/test_screen.py @@ -6,6 +6,7 @@ import numpy as np import nipy as ni +from nipy.core.api import rollimg from ..screens import screen from ..timediff import time_slice_diffs from ...utils.pca import pca @@ -19,6 +20,19 @@ from nipy.testing import funcfile, anatfile +def _check_pca(res, pca_res): + # Standardize output vector signs + screen_pca_res = res2pos1(res['pca_res']) + for key in pca_res: + assert_almost_equal(pca_res[key], screen_pca_res[key]) + + +def _check_ts(res, data, time_axis, slice_axis): + ts_res = time_slice_diffs(data, time_axis, slice_axis) + for key in ts_res: + assert_array_equal(ts_res[key], res['ts_res'][key]) + + def test_screen(): img = ni.load_image(funcfile) res = screen(img) @@ -29,7 +43,7 @@ def test_screen(): 'pca', 'pca_res', 'std', 'ts_res']) data = img.get_data() - + # Check summary images assert_array_equal(np.max(data, axis=-1), res['max'].get_data()) assert_array_equal(np.mean(data, axis=-1), res['mean'].get_data()) assert_array_equal(np.min(data, axis=-1), res['min'].get_data()) @@ -37,11 +51,44 @@ def test_screen(): pca_res = pca(data, axis=-1, standardize=False, ncomp=10) # On windows, there seems to be some randomness in the PCA output vector # signs; this routine sets the basis vectors to have first value positive, - # and therefore standardized the signs + # and therefore standardizes the signs pca_res = res2pos1(pca_res) - screen_pca_res = res2pos1(res['pca_res']) - for key in pca_res: - assert_almost_equal(pca_res[key], screen_pca_res[key]) - ts_res = time_slice_diffs(data) - for key in ts_res: - assert_array_equal(ts_res[key], res['ts_res'][key]) + _check_pca(res, pca_res) + _check_ts(res, data, 3, 2) + # Test that screens accepts and uses time axis + data_mean = data.mean(axis=-1) + res = screen(img, time_axis='t') + assert_array_equal(data_mean, res['mean'].get_data()) + _check_pca(res, pca_res) + _check_ts(res, data, 3, 2) + res = screen(img, time_axis=-1) + assert_array_equal(data_mean, res['mean'].get_data()) + _check_pca(res, pca_res) + _check_ts(res, data, 3, 2) + t0_img = rollimg(img, 't') + t0_data = np.rollaxis(data, -1) + res = screen(t0_img, time_axis='t') + t0_pca_res = pca(t0_data, axis=0, standardize=False, ncomp=10) + t0_pca_res = res2pos1(t0_pca_res) + assert_array_equal(data_mean, res['mean'].get_data()) + _check_pca(res, t0_pca_res) + _check_ts(res, t0_data, 0, 3) + res = screen(t0_img, time_axis=0) + assert_array_equal(data_mean, res['mean'].get_data()) + _check_pca(res, t0_pca_res) + _check_ts(res, t0_data, 0, 3) + # Check screens uses slice axis + s0_img = rollimg(img, 2, 0) + s0_data = np.rollaxis(data, 2, 0) + res = screen(s0_img, slice_axis=0) + _check_ts(res, s0_data, 3, 0) + # And defaults to named slice axis + # First re-show that when we don't specify, we get the default + res = screen(img) + _check_ts(res, data, 3, 2) + assert_raises(AssertionError, _check_ts, res, data, 3, 0) + # Then specify, get non-default + slicey_img = img.renamed_axes(i='slice') + res = screen(slicey_img) + _check_ts(res, data, 3, 0) + assert_raises(AssertionError, _check_ts, res, data, 3, 2) From 617dcf1ca37680d4bb9a9b3ab515713469ba1a7e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 25 Apr 2013 15:59:31 -0700 Subject: [PATCH 152/164] RF: make default slice axis adapt to time axis Add tests for slice axis and time axis specified. This is minor API breakage, because previous default behavior was: time_axis=-2, slice_axis default -> -2 time_axis=0, slice_axis_default -> -2 Now: time_axis=-2, slice_axis default -> -1 time_axis=0, slice_axis_default -> -1 --- .../diagnostics/tests/test_time_difference.py | 24 +++++++++++- nipy/algorithms/diagnostics/timediff.py | 37 ++++++++++--------- 2 files changed, 41 insertions(+), 20 deletions(-) diff --git a/nipy/algorithms/diagnostics/tests/test_time_difference.py b/nipy/algorithms/diagnostics/tests/test_time_difference.py index 675af09974..c3946731fa 100644 --- a/nipy/algorithms/diagnostics/tests/test_time_difference.py +++ b/nipy/algorithms/diagnostics/tests/test_time_difference.py @@ -10,10 +10,11 @@ import scipy.io as sio +from nipy.core.api import rollimg from .. import timediff as tsd -from nose.tools import assert_true, assert_false, \ - assert_equal, assert_raises +from nose.tools import (assert_true, assert_false, assert_equal, + assert_not_equal, assert_raises) from numpy.testing import assert_array_equal, assert_array_almost_equal @@ -66,6 +67,25 @@ def test_time_slice_diffs(): assert_array_almost_equal(results[key], expected[key]) +def test_time_slice_axes(): + # Test time and slice axes work as expected + fimg = load_image(funcfile) + data = fimg.get_data() + orig_results = tsd.time_slice_diffs(data) + t0_data = np.rollaxis(data, 3) + t0_results = tsd.time_slice_diffs(t0_data, 0) + for key in ('volume_means', 'slice_mean_diff2'): + assert_array_almost_equal(orig_results[key], t0_results[key]) + s0_data = np.rollaxis(data, 2) + s0_results = tsd.time_slice_diffs(s0_data, slice_axis=0) + for key in ('volume_means', 'slice_mean_diff2'): + assert_array_almost_equal(orig_results[key], s0_results[key]) + # Incorrect slice axis + bad_s0_results = tsd.time_slice_diffs(s0_data) + assert_not_equal(orig_results['slice_mean_diff2'].shape, + bad_s0_results['slice_mean_diff2'].shape) + + def test_against_matlab_results(): fimg = load_image(funcfile) results = tsd.time_slice_diffs(fimg.get_data()) diff --git a/nipy/algorithms/diagnostics/timediff.py b/nipy/algorithms/diagnostics/timediff.py index 53f2830286..7b79ecf91c 100644 --- a/nipy/algorithms/diagnostics/timediff.py +++ b/nipy/algorithms/diagnostics/timediff.py @@ -5,37 +5,37 @@ These started life as ``tsdiffana.m`` - see http://imaging.mrc-cbu.cam.ac.uk/imaging/DataDiagnostics -Oliver Josephs (FIL) gave me the idea of time-point to time-point +Oliver Josephs (FIL) gave me (MB) the idea of time-point to time-point subtraction as a diagnostic for motion and other sudden image changes. ''' import numpy as np -def time_slice_diffs(arr, time_axis=-1, slice_axis=-2): +def time_slice_diffs(arr, time_axis=-1, slice_axis=None): ''' Time-point to time-point differences over volumes and slices We think of the passed array as an image. The image has a "time" dimension given by `time_axis` and a "slice" dimension, given by - `slice_axis`, and one or other dimensions. In the case of imaging - there will usually be two more dimensions (the dimensions defining - the size of an image slice). A single slice in the time dimension we - call a "volume". A single entry in `arr` is a "voxel". For - example, if `time_axis` == 0, then ``v = arr[0]`` would be the first - volume in the series. The volume ``v`` above has ``v.size`` voxels. - If, in addition, `slice_axis` == 1, then for the volume ``v`` - (above) ``s = v[0]`` would be a "slice", with ``s.size`` - voxels. These are obviously terms from neuroimaging. + `slice_axis`, and one or more other dimensions. In the case of imaging + there will usually be two more dimensions (the dimensions defining the size + of an image slice). A single slice in the time dimension we call a "volume". + A single entry in `arr` is a "voxel". For example, if `time_axis` == 0, + then ``v = arr[0]`` would be the first volume in the series. The volume + ``v`` above has ``v.size`` voxels. If, in addition, `slice_axis` == 1, then + for the volume ``v`` (above) ``s = v[0]`` would be a "slice", with + ``s.size`` voxels. These are obviously terms from neuroimaging. Parameters ---------- arr : array_like Array over which to calculate time and slice differences. We'll call this array an 'image' in this doc. - time_axis : int - axis of `arr` that varies over time. - slice_axis : int - axis of `arr` that varies over image slice. + time_axis : int optional + axis of `arr` that varies over time. Default is last + slice_axis : None or int, optional + axis of `arr` that varies over image slice. None gives last non-time + axis. Returns ------- @@ -48,7 +48,7 @@ def time_slice_diffs(arr, time_axis=-1, slice_axis=-2): time point ``t`` and time point ``t+1`` `results` has keys: - + * 'volume_mean_diff2' : (T-1,) array array containing the mean (over voxels in volume) of the squared difference from one time point to the next @@ -71,7 +71,9 @@ def time_slice_diffs(arr, time_axis=-1, slice_axis=-2): # roll time axis to 0, slice axis to 1 for convenience if time_axis < 0: time_axis += ndim - if slice_axis < 0: + if slice_axis is None: + slice_axis = ndim-2 if time_axis == ndim-1 else ndim-1 + elif slice_axis < 0: slice_axis += ndim arr = np.rollaxis(arr, time_axis) # we may have changed the position of slice_axis @@ -114,4 +116,3 @@ def time_slice_diffs(arr, time_axis=-1, slice_axis=-2): 'volume_means': means, 'diff2_mean_vol': diff_mean_vol, 'slice_diff2_max_vol': slice_diff_max_vol} - From 8cca5ff029a63c591f30c2681c8a0e7fced78680 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Thu, 25 Apr 2013 16:35:27 -0700 Subject: [PATCH 153/164] RF: add time_axis, slice_axis to nipy_diagnose Allow nipy_diagnose to work on arbitrary slice axis --- nipy/tests/test_scripts.py | 22 ++++++++++++++++++++-- scripts/nipy_diagnose | 16 +++++++++++++++- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/nipy/tests/test_scripts.py b/nipy/tests/test_scripts.py index b6f2bc7667..46ed0db096 100644 --- a/nipy/tests/test_scripts.py +++ b/nipy/tests/test_scripts.py @@ -14,9 +14,12 @@ from subprocess import Popen, PIPE +import numpy as np + from nibabel.tmpdirs import InTemporaryDirectory -from nipy import load_image +from nipy import load_image, save_image +from nipy.core.api import rollimg from nose.tools import assert_true, assert_false, assert_equal @@ -93,7 +96,22 @@ def test_nipy_diagnose(): del img pca_img = load_image('pca_functional.nii.gz') assert_equal(pca_img.shape, fimg.shape[:-1] + (ncomps,)) - del pca_img + vecs_comps = np.load('vectors_components_functional.npz') + vec_diff = vecs_comps['slice_mean_diff2'].copy()# just in case + assert_equal(vec_diff.shape, (fimg.shape[-1]-1, fimg.shape[2])) + del pca_img, vecs_comps + with InTemporaryDirectory() as tmpdir: + # Check we can pass in slice and time flags + s0_img = rollimg(fimg, 'k') + save_image(s0_img, 'slice0.nii') + cmd = ('nipy_diagnose slice0.nii --ncomponents=%d --out-path="%s" ' + '--time-axis=t --slice-axis=0' % (ncomps, tmpdir)) + run_command(cmd) + pca_img = load_image('pca_slice0.nii') + assert_equal(pca_img.shape, s0_img.shape[:-1] + (ncomps,)) + vecs_comps = np.load('vectors_components_slice0.npz') + assert_almost_equal(vecs_comps['slice_mean_diff2'], vec_diff) + del pca_img, vecs_comps @needs_mpl diff --git a/scripts/nipy_diagnose b/scripts/nipy_diagnose index d7c139b123..7bfe4dab71 100755 --- a/scripts/nipy_diagnose +++ b/scripts/nipy_diagnose @@ -54,6 +54,10 @@ def main(): help='mid part of output image filenames') parser.add_argument('--ncomponents', type=int, default=10, help='number of PCA components to write') + parser.add_argument('--time-axis', type=str, default=-1, + help='Image axis for time') + parser.add_argument('--slice-axis', type=str, default=None, + help='Image axis for slice') # parse the command line args = parser.parse_args() # process inputs @@ -69,7 +73,17 @@ def main(): if out_root is None: out_root = fname img = nipy.load_image(filename) - res = nads.screen(img, ncomps) + # Unpack axis arguments + try: + args.time_axis = int(args.time_axis) + except ValueError: + pass + if not args.slice_axis is None: + try: + args.slice_axis = int(args.slice_axis) + except ValueError: + pass + res = nads.screen(img, ncomps, args.time_axis, args.slice_axis) nads.write_screen_res(res, out_path, out_root, ext + gz) From 63a043ffe38baa5b09c9d1c90d183beb926aed7b Mon Sep 17 00:00:00 2001 From: bthirion Date: Fri, 26 Apr 2013 23:48:17 +0200 Subject: [PATCH 154/164] many other simplifications + pep8 on part of the code base --- examples/labs/bayesian_structural_analysis.py | 29 +- .../need_data/bayesian_structural_analysis.py | 11 +- .../bayesian_structural_analysis.py | 285 +++++------------- nipy/labs/spatial_models/bsa_io.py | 42 +-- nipy/labs/spatial_models/structural_bfls.py | 32 +- nipy/labs/spatial_models/tests/test_bsa.py | 19 +- 6 files changed, 139 insertions(+), 279 deletions(-) diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index cf1cb93979..7e68544e1a 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -27,10 +27,8 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, - prevalence_pval=0.5, smin=0, method='simple', verbose=0): - """ - Function for performing bayesian structural analysis - on a set of images. + prevalence_pval=0.5, smin=0, algorithm='density', verbose=0): + """ Performing Bayesian structural analysis on a set of 2D images Parameters ---------- @@ -58,20 +56,13 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, """ ref_dim = np.shape(betas[0]) n_subjects = betas.shape[0] - + domain = domain_from_binary_array(np.ones(ref_dim)) + # get the functional information stats = np.array([np.ravel(betas[k]) for k in range(n_subjects)]).T - lmax = 0 - domain = domain_from_binary_array(np.ones(ref_dim)) - - if method == 'simple': - algorithm = 'standard' - elif method == 'quick': - algorithm = 'quick' - else: - raise ValueError('method is not correctly defined') + # main call landmarks, hrois = compute_landmarks( domain, stats, sigma, prevalence_pval, prevalence_threshold, threshold, smin, method='prior', algorithm=algorithm) @@ -95,9 +86,8 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, fig_output.text(.5, .9, "Individual landmark regions", ha="center") for s in range(n_subjects): plt.subplot(n_subjects / 5, 5, s + 1) - #ax.set_position([.02, .02, .96, .96]) lw = - np.ones(ref_dim) - if hrois[s] is not None: + if hrois[s].k > 0: nls = hrois[s].get_roi_feature('label') nls[nls == - 1] = np.size(landmarks) + 2 for k in range(hrois[s].k): @@ -162,9 +152,10 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, prevalence_pval = 0.9 verbose = 1 smin = 5 -method = 'quick' # 'simple' # +algorithm = 'co-occurrence' # 'density' # run the algo -landmarks, hrois = make_bsa_2d(betas, threshold, sigma, prevalence_threshold, - prevalence_pval, smin, method, verbose=verbose) +landmarks, hrois = make_bsa_2d( + betas, threshold, sigma, prevalence_threshold, prevalence_pval, smin, + algorithm=algorithm, verbose=verbose) plt.show() diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index 1b2ad4f66a..462d713900 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -6,7 +6,7 @@ Example of a script that uses the BSA (Bayesian Structural Analysis) i.e. nipy.labs.spatial_models.bayesian_structural_analysis module. -Author : Bertrand Thirion, 2008-2010 +Author : Bertrand Thirion, 2008-2013 """ print(__doc__) @@ -38,7 +38,7 @@ # set various parameters subj_id = ['%04d' % i for i in range(12)] -threshold = float(stats.t.isf(0.01, 100)) +threshold = 100 # float(stats.t.isf(0.01, 100)) sigma = 4. prevalence_threshold = 2 prevalence_pval = 0.95 @@ -47,12 +47,13 @@ if not path.exists(write_dir): mkdir(write_dir) -method = 'quick' -print('method used:', method) +algorithm = 'density' +print('algorithm used:', algorithm) # call the function landmarks, individual_rois = make_bsa_image( mask_images, betas, threshold, smin, sigma, prevalence_threshold, - prevalence_pval, write_dir, method, '%04d' % nbeta) + prevalence_pval, write_dir, algorithm=algorithm, + contrast_id='%04d' % nbeta) print("Wrote all the results in directory %s" % write_dir) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index ba4f0cfcbb..3df2477674 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -29,32 +29,6 @@ #################################################################### -def _relabel(label, new_values=None): - """ Utility to relabel a pre-existing label vector - to the values provided in new_values. - - Parameters - ---------- - label: array of shape(n), - the inut labels - new_values: array of shape(p), where p<= label.max(), optional - if None, the output is -1 * np.ones(n) - the new values to be given to the labels - - Returns - ------- - new_label: array of shape (n) - """ - if label.max() + 1 < np.size(new_values): - raise ValueError('incompatible values for label of new_values') - new_label = - np.ones_like(label) - if new_values is not None: - aux = np.arange(label.max() + 1) - aux[0: np.size(new_values)] = new_values - new_label[label > - 1] = aux[label[label > - 1]] - return new_label - - def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): """Convert a set of statistics to posterior probabilities of being generated under H0 @@ -76,10 +50,10 @@ def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): parameter that yields the prior probability that a region is active should be chosen close to 0 - Returns + Returns ------- posterior_null: array of shape(n_samples) - an estimation of the probability that the observation + an estimation of the probability that the observation is generated under the null """ if method == 'gauss_mixture': @@ -154,7 +128,7 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, stats_ = np.reshape(stats[:, subject], (nvox, 1)) hroi = HROI_as_discrete_domain_blobs( domain, stats_, threshold=threshold, smin=smin) - + if hroi is not None and hroi.k > 0: # get the leave regions (i.e. the local maxima) leaves = [hroi.select_id(id) for id in hroi.get_leaves_id()] @@ -178,15 +152,15 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, prior_h0.append([]) coords.append(np.empty((0, domain.dim))) hrois.append(hroi) - + prior_h0 = np.concatenate(prior_h0) subjects = np.concatenate(subjects) coords = np.concatenate(coords) return hrois, prior_h0, subjects, coords -def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, - subjects, sampling_coords=None, n_iter=1000, burnin=100, +def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, sampling_coords=None, n_iter=1000, burnin=100, co_clust=False, verbose=False): """Apply the dpmm analysis to compute clusters from regions coordinates """ @@ -205,7 +179,7 @@ def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, # sampling like, pproba, co_clustering = migmm.sample( - coords, null_class_proba=prior_h0, niter=n_iter, kfold=subjects, + coords, null_class_proba=prior_h0, niter=n_iter, kfold=subjects, sampling_points=sampling_coords, co_clustering=True) if co_clust: @@ -214,9 +188,18 @@ def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, return like, 1 - pproba -def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, +def _update_hroi_labels(hrois, new_labels): + """Update the labels of the hroisusing new_labels""" + for subject in range(len(hrois)): + if hrois[subject].k > 0: + us = hrois[subject].get_roi_feature('label') + us[us > - 1] = new_labels[us[us > - 1]] + hrois[subject].set_roi_feature('label', us) + + +def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, - verbose=0): + algorithm='density', verbose=0): """ Estimation of the population level model of activation density using dpmm and inference @@ -238,29 +221,25 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, p-value of the prevalence test prevalence_threshold: float in the rannge [0,nsubj] null hypothesis on region prevalence + algorithm, string, one of ['density', 'co_occurrence'], optional, verbose=0, verbosity mode Returns ------- - label_map: array of shape (nnodes): - the resulting group-level labelling of the space landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found in inter-subject inference If no such thing can be defined landmarks is set to None hrois: List of nipy.labs.spatial_models.hroi.HierarchicalROI instances representing individual ROIs - density: array of shape (nnodes): - likelihood of the data under H1 over some sampling grid """ from nipy.algorithms.graph.field import field_from_coo_matrix_and_data domain = hrois[0].domain n_subjects = len(hrois) - label_map = - np.ones(domain.size, np.int) landmarks = None density = np.zeros(domain.size) if len(subjects) < 1: - return label_map, landmarks, hrois, density + return landmarks, hrois null_density = 1. / domain.local_volume.sum() @@ -269,45 +248,58 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prior_precision = 1. / (sigma ** 2) * np.ones((1, dim)) # n_iter = number of iterations to estimate density - density, post_proba = _dpmm( - coords, alpha, null_density, dof, prior_precision, prior_h0, - subjects, domain.coord, n_iter=n_iter, burnin=burnin) - - Fbeta = field_from_coo_matrix_and_data(domain.topology, density) - _, label = Fbeta.custom_watershed(0, null_density) + if algorithm == 'density': + density, post_proba = _dpmm( + coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, domain.coord, n_iter=n_iter, burnin=burnin) + # associate labels with coords + Fbeta = field_from_coo_matrix_and_data(domain.topology, density) + _, label = Fbeta.custom_watershed(0, null_density) + midx = np.array([np.argmin(np.sum((domain.coord - coord_) ** 2, 1)) + for coord_ in coords]) + components = label[midx] + elif algorithm == 'co-occurrence': + post_proba, density, co_clustering = _dpmm( + coords, alpha, null_density, dof, prior_precision, prior_h0, + subjects, n_iter=n_iter, burnin=burnin, co_clust=True) + contingency_graph = wgraph_from_coo_matrix(co_clustering) + if contingency_graph.E > 0: + contingency_graph.remove_edges(contingency_graph.weights > .5) + + components = contingency_graph.cc() + components[density < null_density] = components.max() + 1 +\ + np.arange(np.sum(density < null_density)) + else: + raise ValueError('Unknown algorithm') # append some information to the hroi in each subject - components = [] for subject in range(n_subjects): bfs = hrois[subject] - if bfs.k > 0: - leaves_pos = [bfs.select_id(k) for k in bfs.get_leaves_id()] - - # set posterior proba - post_proba_ = np.zeros(bfs.k) - post_proba_[leaves_pos] = post_proba[subjects == subject] - bfs.set_roi_feature('posterior_proba', post_proba_) - - # set prior proba - prior_proba = np.zeros(bfs.k) - prior_proba[leaves_pos] = 1 - prior_h0[subjects == subject] - bfs.set_roi_feature('prior_proba', prior_proba) - - # assign labels to ROIs - pos = np.asarray( - [np.mean(coords, 0) for coords in bfs.get_coord()]) - midx = np.array([np.argmin(np.sum((domain.coord - pos[k]) ** 2, 1)) - for k in range(bfs.k)]) - roi_label = - np.ones(bfs.k).astype(np.int) - j = label[midx] - roi_label[leaves_pos] = j[leaves_pos] - components.append(j[leaves_pos]) - - # when parent regions has similarly labelled children, - # include it also - roi_label = bfs.make_forest().propagate_upward(roi_label) - bfs.set_roi_feature('label', roi_label) - + if bfs is None: + continue + if bfs.k == 0: + bfs.set_roi_feature('label', np.array([])) + continue + + leaves_pos = [bfs.select_id(k) for k in bfs.get_leaves_id()] + # save posterior proba + post_proba_ = np.zeros(bfs.k) + post_proba_[leaves_pos] = post_proba[subjects == subject] + bfs.set_roi_feature('posterior_proba', post_proba_) + + # save prior proba + prior_proba = np.zeros(bfs.k) + prior_proba[leaves_pos] = 1 - prior_h0[subjects == subject] + bfs.set_roi_feature('prior_proba', prior_proba) + + # assign labels to ROIs + roi_label = - np.ones(bfs.k).astype(np.int) + roi_label[leaves_pos] = components[subjects == subject] + # when parent regions has similarly labelled children, + # include it also + roi_label = bfs.make_forest().propagate_upward(roi_label) + bfs.set_roi_feature('label', roi_label) + # derive the group-level landmarks # with a threshold on the number of subjects # that are represented in each one @@ -317,126 +309,9 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # relabel the regions _update_hroi_labels(hrois, new_labels) - - # make a group-level map of the landmark position - label_map = _relabel(label, new_labels) - return label_map, landmarks, hrois, density - - -def _update_hroi_labels(hrois, new_labels): - """Update the labels of the hroisusing new_labels""" - for subject in range(len(hrois)): - if hrois[subject].k > 0: - us = hrois[subject].get_roi_feature('label') - us[us > - 1] = new_labels[us[us > - 1]] - hrois[subject].set_roi_feature('label', us) - - -def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, - verbose=False): - """ Estimation of the population level model of activation density using - dpmm and inference - - Parameters - ---------- - hrois list of nipy.labs.spatial_models.hroi.HierarchicalROI instances - representing individual ROIs - let nr be the number of terminal regions across subjects - prior_h0, array of shape (nr) - the mixture-based prior probability - that the terminal regions are false positives - subjects, array of shape (nr) - the subject index associated with the terminal regions - coords, array of shape (nr, coord.shape[1]) - the coordinates of the of the terminal regions - sigma float>0: - expected cluster std in the common space in units of coord - prevalence_pval = 0.5 (float in the [0,1] interval) - p-value of the prevalence test - prevalence_threshold=0, float in the rannge [0,nsubj] - null hypothesis on region prevalence that is rejected during inference - verbose=0, verbosity mode - - Returns - ------- - label_map: array of shape (nnodes): - the resulting group-level labelling of the space - landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found - in inter-subject inference - If no such thing can be defined landmarks is set to None - hrois: List of nipy.labs.spatial_models.hroi.Nroi instances - representing individual ROIs - Coclust: array of shape (nr,nr): - co-labelling matrix that gives for each pair of inputs - how likely they are in the same class according to the model - """ - domain = hrois[0].domain - n_subjects = len(hrois) - label_map = - np.ones(domain.size, np.int) - landmarks = None - density = np.zeros(domain.size) - if len(subjects) < 1: - return label_map, landmarks, hrois, density - - # prepare the DPMM - null_density = 1. / (np.sum(domain.local_volume)) - prior_precision = 1. / (sigma ** 2) * np.ones((1, domain.em_dim), np.float) - - post_proba, density, co_clustering = _dpmm( - coords, alpha, null_density, dof, prior_precision, prior_h0, - subjects, n_iter=n_iter, burnin=burnin, co_clust=True) - - contingency_graph = wgraph_from_coo_matrix(co_clustering) - if contingency_graph.E > 0: - contingency_graph.remove_edges(contingency_graph.weights > .5) - - components = contingency_graph.cc() - components[density < null_density] = components.max() + 1 +\ - np.arange(np.sum(density < null_density)) - - # append some information to the hroi in each subject - for subject in range(n_subjects): - bfs = hrois[subject] - if bfs is not None: - if bfs.k > 0: - leaves = np.asarray( - [bfs.select_id(id) for id in bfs.get_leaves_id()]) - roi_label = - np.ones(bfs.k).astype(np.int) - - # posterior proba of activation - post_proba_ = np.zeros(bfs.k) - post_proba_[leaves] = post_proba[subjects == subject] - bfs.set_roi_feature('posterior_proba', post_proba_) - - # prior_proba of activation - prior_proba = np.zeros(bfs.k) - prior_proba[leaves] = 1 - prior_h0[subjects == subject] - bfs.set_roi_feature('prior_proba', prior_proba) - roi_label[leaves] = components[subjects == subject] - - # when parent regions has similarly labelled children, - # include it also - roi_label = bfs.make_forest().propagate_upward(roi_label) - bfs.set_roi_feature('label', roi_label) - else: - bfs.set_roi_feature('label', np.array([])) - - # derive the group-level landmarks - # with a threshold on the number of subjects - # that are represented in each one - landmarks, new_labels = build_landmarks( - domain, coords, subjects, components, 1 - prior_h0, - prevalence_pval, prevalence_threshold, sigma, verbose=verbose) - - # relabel the regions - _update_hroi_labels(hrois, new_labels) - # make a group-level map of the landmark position - label_map = - np.ones(domain.size) - # not implemented at the moment + return landmarks, hrois - return label_map, landmarks, hrois, co_clustering ########################################################################### # Main function @@ -444,8 +319,8 @@ def bsa_dpmm2(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, def compute_landmarks( - domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, - threshold=3.0, smin=5, method='prior', algorithm='quick', verbose=0): + domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, + threshold=3.0, smin=5, method='prior', algorithm='density', verbose=0): """ Compute the Bayesian Structural Activation paterns simplified version @@ -464,7 +339,7 @@ def compute_landmarks( threshold = 3.0 (float): first level threshold method: string, optional, the method used to assess the prior significance of the regions - algorithm: string, one of ['quick', 'standard'], + algorithm: string, one of ['density', 'co-occurrence'], optional method used to compute the landmarks verbose=0: verbosity mode @@ -478,15 +353,9 @@ def compute_landmarks( """ hrois, prior_h0, subjects, coords = _compute_individual_regions( domain, stats, threshold, smin, method, verbose) - - if algorithm == 'standard': - label_map, landmarks, hrois, density = bsa_dpmm( - hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, verbose=verbose) - elif algorithm == 'quick': - label_map, landmarks, hrois, co_clust = bsa_dpmm2( - hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, verbose=verbose) - else: - raise ValueError('Unknown method') + + landmarks, hrois = bsa_dpmm( + hrois, prior_h0, subjects, coords, sigma, prevalence_pval, + prevalence_threshold, algorithm=algorithm, verbose=verbose) + return landmarks, hrois diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 2e76332274..7f4d54670f 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -15,9 +15,9 @@ def make_bsa_image( - mask_images, stat_images, threshold=3., smin=0, sigma=5., - prevalence_threshold=0, prevalence_pval=0.5, write_dir=None, - method='simple', contrast_id='default', verbose=0): + mask_images, stat_images, threshold=3., smin=0, sigma=5., + prevalence_threshold=0, prevalence_pval=0.5, write_dir=None, + algorithm='density', contrast_id='default', verbose=0): """ Main function for performing bsa on a set of images. It creates the some output images in the given directory @@ -29,11 +29,11 @@ def make_bsa_image( one for each subject threshold: float, optional, threshold used to ignore all the image data that si below - sigma: float, optional + sigma: float, optional variance of the spatial model, i.e. cross-subject uncertainty prevalence_threshold: float, optional threshold on the representativity measure - prevalence_pval: float, optional + prevalence_pval: float, optional p-value of the representativity test: test = p(representativity>prevalence_threshold) > prevalence_pval smin: float, optional @@ -41,7 +41,7 @@ def make_bsa_image( smaller blobs are merged into larger ones write_dir: string, optional if not None, output directory - method: string, one of ['simple', 'quick'], optional, + method: string, one of ['density', 'co-occurrence'], optional, applied region detection method; to be chose among contrast_id: string, optional, identifier of the contrast @@ -81,21 +81,24 @@ def make_bsa_image( stats = np.array(stats).T # launch the method - crmap = np.zeros(n_voxels).astype(np.int16) + crmap = - np.ones(n_voxels).astype(np.int16) density = np.zeros(n_voxels) landmarks = None hrois = [None for _ in range(n_subjects)] - - if method == 'simple': - algorithm = 'standard' - else: - algorithm = 'quick' + default_idx = 0 + prevalence = np.array([]) landmarks, hrois = compute_landmarks( domain, stats, sigma, prevalence_pval, prevalence_threshold, threshold, smin, algorithm=algorithm, verbose=verbose) - crmap = landmarks.map_label(domain.coord, 0.95, sigma) - density = landmarks.kernel_density(k=None, coord=domain.coord, sigma=sigma) + + if landmarks is not None: + crmap = landmarks.map_label(domain.coord, 0.95, sigma) + density = landmarks.kernel_density( + k=None, coord=domain.coord, sigma=sigma) + default_idx = landmarks.k + 2 + prevalence = landmarks.roi_prevalence() + if write_dir == False: return landmarks, hrois @@ -110,19 +113,16 @@ def make_bsa_image( dens_path = op.join(write_dir, "density_%s.nii" % contrast_id) save(wim, dens_path) - default_idx = landmarks.k + 2 - # write a 3D image for group-level labels labels = - 2 * np.ones(ref_dim) labels[mask > 0] = crmap wim = Nifti1Image(labels.astype('int16'), affine) wim.get_header()['descrip'] = 'group Level labels from bsa procedure' save(wim, op.join(write_dir, "CR_%s.nii" % contrast_id)) - + # write a prevalence image - prev_ = np.zeros_like(crmap) - prev_[crmap > -1] = landmarks.roi_prevalence()[(crmap[crmap > -1]).\ - astype(np.int)] + prev_ = np.zeros(crmap.size).astype(np.float) + prev_[crmap > -1] = prevalence[crmap[crmap > -1]] prevalence_map = - np.ones(ref_dim) prevalence_map[mask > 0] = prev_ wim = Nifti1Image(prevalence_map, affine) @@ -134,7 +134,7 @@ def make_bsa_image( labels = - 2 * np.ones(wdim, 'int16') for subject in range(n_subjects): labels[mask > 0, subject] = - 1 - if hrois[subject] is not None: + if hrois[subject].k > 0: nls = hrois[subject].get_roi_feature('label') nls[nls == - 1] = default_idx lab = hrois[subject].label diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index cc7695f256..2d53e5e0a0 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -29,7 +29,7 @@ def _threshold_weight_map(x, fraction): idx = np.where(np.cumsum(sorted_x) < fraction * x.sum())[0][-1] x[x < sorted_x[idx]] = 0 return x - + class LandmarkRegions(object): """ @@ -80,7 +80,7 @@ def centers(self): def kernel_density(self, k=None, coord=None, sigma=1.): """ Compute the density of a component as a kde - + Parameters ---------- k: int (<= self.k) or None @@ -90,7 +90,7 @@ def kernel_density(self, k=None, coord=None, sigma=1.): a set of input coordinates sigma: float, optional kernel size - + Returns ------- kde: array of shape(n) @@ -104,15 +104,15 @@ def kernel_density(self, k=None, coord=None, sigma=1.): for k in range(self.k): pos = self.get_feature('position')[k] dist = euclidean_distance(pos, coord) - kde += np.exp( - dist ** 2 / (2 * sigma ** 2)).sum(0) + kde += np.exp(- dist ** 2 / (2 * sigma ** 2)).sum(0) else: k = int(k) pos = self.get_feature('position')[k] dist = euclidean_distance(pos, coord) - kde = np.exp( - dist ** 2 / (2 * sigma ** 2)).sum(0) + kde = np.exp(- dist ** 2 / (2 * sigma ** 2)).sum(0) return kde / (2 * np.pi * sigma ** 2) ** (pos.shape[1] / 2) - def map_label(self, coord=None, pval=1., dmax=1.): + def map_label(self, coord=None, pval=1., sigma=1.): """Sample the set of landmark regions on the proposed coordiante set cs, assuming a Gaussian shape @@ -122,8 +122,8 @@ def map_label(self, coord=None, pval=1., dmax=1.): a set of input coordinates pval: float in [0,1]), optional cutoff for the CR, i.e. highest posterior density threshold - dmax: an upper bound for the spatial variance - to avoid degenerate variance + sigma: float, positive, optional + spatial scale of the spatial model Returns ------- @@ -136,9 +136,9 @@ def map_label(self, coord=None, pval=1., dmax=1.): if self.k > 0: aux = - np.zeros((coord.shape[0], self.k)) for k in range(self.k): - kde = self.kernel_density(k, coord, dmax) + kde = self.kernel_density(k, coord, sigma) aux[:, k] = _threshold_weight_map(kde, pval) - + aux[aux < null_density] = 0 maux = np.max(aux, 1) label[maux > 0] = np.argmax(aux, 1)[maux > 0] @@ -183,7 +183,7 @@ def roi_prevalence(self, fid='confidence'): def build_landmarks(domain, coords, subjects, labels, confidence=None, - prevalence_pval=0.95, prevalence_threshold=0, dmax=1., + prevalence_pval=0.95, prevalence_threshold=0, sigma=1., verbose=0): """ Given a list of hierarchical ROIs, and an associated labelling, this @@ -200,11 +200,11 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, labels: array of shape (n), dtype = np.int index of the landmark the object is associated with prevalence_pval: float, optional - prevalence_threshold: float, optional, - (c) A label should be present in prevalence_threshold + prevalence_threshold: float, optional, + (c) A label should be present in prevalence_threshold subjects with a probability>prevalence_pval in order to be valid - dmax: float optional, + sigma: float optional, regularizing constant that defines a prior on the region extent Returns @@ -232,7 +232,7 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, mean_c, var_c = 0., 0. subjects_i = subjects[labels == i] for subject_i in np.unique(subjects_i): - confidence_i = 1 - np.prod(1 - confidence[(labels == i) * + confidence_i = 1 - np.prod(1 - confidence[(labels == i) * (subjects == subject_i)]) mean_c += confidence_i var_c += confidence_i * (1 - confidence_i) @@ -245,7 +245,7 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, prevalence_pval): coord = np.vstack([ coords[subjects == s][k] for (k, s) in zip( - intrasubj[labels == i], + intrasubj[labels == i], subjects[labels == i])]) valid[i] = 1 coordinates.append(coord) diff --git a/nipy/labs/spatial_models/tests/test_bsa.py b/nipy/labs/spatial_models/tests/test_bsa.py index 87b0af0073..e8b1a09e65 100644 --- a/nipy/labs/spatial_models/tests/test_bsa.py +++ b/nipy/labs/spatial_models/tests/test_bsa.py @@ -18,12 +18,10 @@ from ..discrete_domain import domain_from_binary_array -def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, - nbeta=[0], method='simple'): +def make_bsa_2d(betas, theta=3., sigma=5., ths=0, thq=0.5, smin=0, + nbeta=[0], algorithm='density'): """ Function for performing bayesian structural analysis on a set of images. - - Fixme: 'quick' is not tested """ ref_dim = np.shape(betas[0]) n_subj = betas.shape[0] @@ -34,8 +32,8 @@ def make_bsa_2d(betas, theta=3., dmax=5., ths=0, thq=0.5, smin=0, # the voxel volume is 1.0 dom = domain_from_binary_array(np.ones(ref_dim)) - if method == 'simple': - AF, BF = compute_landmarks(dom, lbeta, dmax, thq, ths, theta, smin) + AF, BF = compute_landmarks(dom, lbeta, sigma, thq, ths, theta, smin, + algorithm=algorithm) return AF, BF @@ -67,7 +65,7 @@ def test_bsa_methods(): #pos_betas = np.reshape(pos_dataset, (n_subj, shape[0], shape[1])) # set various parameters theta = float(st.t.isf(0.01, 100)) - dmax = 5. / 1.5 + sigma = 5. / 1.5 half_subjs = n_subj / 2 thq = 0.9 smin = 5 @@ -75,12 +73,13 @@ def test_bsa_methods(): # tuple of tuples with each tuple being # (name_of_method, ths_value, data_set, test_function) algs_tests = ( - ('simple', half_subjs, null_betas, lambda AF, BF: AF.k == 0), - ('simple', 1, pos_betas, lambda AF, BF: AF.k > 1)) + ('density', half_subjs, null_betas, lambda AF, BF: AF.k == 0), + ('density', 1, pos_betas, lambda AF, BF: AF.k > 1)) for name, ths, betas, test_func in algs_tests: # run the algo - AF, BF = make_bsa_2d(betas, theta, dmax, ths, thq, smin, method=name) + AF, BF = make_bsa_2d(betas, theta, sigma, ths, thq, smin, + algorithm=name) yield assert_true, test_func(AF, BF) From 3652cb9679dbfa9699c01832a96920896ef3b8b4 Mon Sep 17 00:00:00 2001 From: bthirion Date: Fri, 3 May 2013 23:19:51 +0200 Subject: [PATCH 155/164] A few fixes in the docstrings of the examples --- examples/labs/bayesian_structural_analysis.py | 29 ++++++++++--------- .../need_data/bayesian_structural_analysis.py | 2 +- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index 7e68544e1a..be1447b1d2 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -34,25 +34,28 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, ---------- betas, array of shape (n_subjects, dimx, dimy) the data used Note that it is assumed to be a t- or z-variate - threshold=3., float, + threshold: float, optional first level threshold of betas - sigma=5., float, expected between subject variability - prevalence_threshold=0, float, + sigma: float, optional, + kernel size in mm + prevalence_threshold: float, optional null hypothesis for the prevalence statistic - prevalence_pval=0.5, float, + prevalence_pval: float, optional p-value of the null rejection - smin=0, int, - threshold on the nu_mber of contiguous voxels - to make regions meaningful structures - method= 'simple', string, - estimation method used ; to be chosen among - 'simple', 'quick', 'loo', 'ipmi' - verbose=0, verbosity mode + smin: int, optional + threshold on the number of contiguous voxels + in individual regions + method: string, + estimation method used + verbose: int, + verbosity mode Returns ------- - landmarks the landmark_regions instance describing the result - hrois: list of hroi instances describing the individual data + landmarks: object, + the landmark_regions instance describing the population regions + hrois: list, + set of hroi instances describing the individual regions """ ref_dim = np.shape(betas[0]) n_subjects = betas.shape[0] diff --git a/examples/labs/need_data/bayesian_structural_analysis.py b/examples/labs/need_data/bayesian_structural_analysis.py index 462d713900..2a38be1ba9 100755 --- a/examples/labs/need_data/bayesian_structural_analysis.py +++ b/examples/labs/need_data/bayesian_structural_analysis.py @@ -38,7 +38,7 @@ # set various parameters subj_id = ['%04d' % i for i in range(12)] -threshold = 100 # float(stats.t.isf(0.01, 100)) +threshold = float(stats.t.isf(0.01, 100)) sigma = 4. prevalence_threshold = 2 prevalence_pval = 0.95 From e757cd92ee898ecdcbcecb77dfcc25c2f55a79c6 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 8 May 2013 15:52:41 +0200 Subject: [PATCH 156/164] Further simplified the bsa example --- examples/labs/bayesian_structural_analysis.py | 137 ++++++------------ 1 file changed, 47 insertions(+), 90 deletions(-) diff --git a/examples/labs/bayesian_structural_analysis.py b/examples/labs/bayesian_structural_analysis.py index be1447b1d2..400ad91b6e 100755 --- a/examples/labs/bayesian_structural_analysis.py +++ b/examples/labs/bayesian_structural_analysis.py @@ -23,115 +23,62 @@ import nipy.labs.utils.simul_multisubject_fmri_dataset as simul from nipy.labs.spatial_models.bayesian_structural_analysis import\ compute_landmarks -from nipy.labs.spatial_models.discrete_domain import domain_from_binary_array - - -def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, - prevalence_pval=0.5, smin=0, algorithm='density', verbose=0): - """ Performing Bayesian structural analysis on a set of 2D images - - Parameters - ---------- - betas, array of shape (n_subjects, dimx, dimy) the data used - Note that it is assumed to be a t- or z-variate - threshold: float, optional - first level threshold of betas - sigma: float, optional, - kernel size in mm - prevalence_threshold: float, optional - null hypothesis for the prevalence statistic - prevalence_pval: float, optional - p-value of the null rejection - smin: int, optional - threshold on the number of contiguous voxels - in individual regions - method: string, - estimation method used - verbose: int, - verbosity mode - - Returns - ------- - landmarks: object, - the landmark_regions instance describing the population regions - hrois: list, - set of hroi instances describing the individual regions - """ - ref_dim = np.shape(betas[0]) - n_subjects = betas.shape[0] - domain = domain_from_binary_array(np.ones(ref_dim)) +from nipy.labs.spatial_models.discrete_domain import grid_domain_from_shape + - # get the functional information - stats = np.array([np.ravel(betas[k]) for k in range(n_subjects)]).T +def display_landmarks_2d(landmarks, hrois, stats): + """ Plots the landmarks and associated rois as images""" + shape = stats[0].shape + n_subjects = len(stats) lmax = 0 - - # main call - landmarks, hrois = compute_landmarks( - domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, method='prior', algorithm=algorithm) - + grp_map, density = np.zeros(shape), np.zeros(shape) if landmarks != None: - grp_map = landmarks.map_label(domain.coord, .8, sigma) - grp_map.shape = ref_dim - group_map = landmarks.map_label(domain.coord, 0.95, sigma) + domain = landmarks.domain + grp_map = landmarks.map_label(domain.coord, .8, sigma).reshape(shape) density = landmarks.kernel_density(k=None, coord=domain.coord, - sigma=sigma) - group_map.shape = ref_dim - - if verbose == 0: - return landmarks, hrois - - if landmarks != None: + sigma=sigma).reshape(shape) lmax = landmarks.k + 2 - landmarks.show() + + # Figure 1: input data + fig_input = plt.figure(figsize=(8, 3.5)) + fig_input.text(.5,.9, "Input activation maps", ha='center') + vmin, vmax = stats.min(), stats.max() + for subject in range(n_subjects): + plt.subplot(n_subjects / 5, 5, subject + 1) + plt.imshow(stats[subject], interpolation='nearest', + vmin=vmin, vmax=vmax) + plt.axis('off') + # Figure 2: individual hrois fig_output = plt.figure(figsize=(8, 3.5)) fig_output.text(.5, .9, "Individual landmark regions", ha="center") - for s in range(n_subjects): - plt.subplot(n_subjects / 5, 5, s + 1) - lw = - np.ones(ref_dim) - if hrois[s].k > 0: - nls = hrois[s].get_roi_feature('label') + for subject in range(n_subjects): + plt.subplot(n_subjects / 5, 5, subject + 1) + lw = - np.ones(shape) + if hrois[subject].k > 0: + nls = hrois[subject].get_roi_feature('label') nls[nls == - 1] = np.size(landmarks) + 2 - for k in range(hrois[s].k): - np.ravel(lw)[hrois[s].label == k] = nls[k] + for k in range(hrois[subject].k): + np.ravel(lw)[hrois[subject].label == k] = nls[k] plt.imshow(lw, interpolation='nearest', vmin=-1, vmax=lmax) plt.axis('off') - - fig_input = plt.figure(figsize=(8, 3.5)) - fig_input.text(.5,.9, "Input activation maps", ha='center') - for s in range(n_subjects): - plt.subplot(n_subjects / 5, 5, s + 1) - plt.imshow(betas[s], interpolation='nearest', vmin=betas.min(), - vmax=betas.max()) - plt.axis('off') - if landmarks is None: - return landmarks, hrois - plt.figure(figsize=(8, 3)) - - plt.subplot(1, 3, 1) - plt.imshow(group_map, interpolation='nearest', vmin=-1, vmax=lmax) - plt.title('Blob separation map', fontsize=10) - plt.axis('off') - plt.colorbar(shrink=.8) + # Figure 3: Group-level results + plt.figure(figsize=(6, 3)) - plt.subplot(1, 3, 2) + plt.subplot(1, 2, 1) plt.imshow(grp_map, interpolation='nearest', vmin=-1, vmax=lmax) plt.title('group-level position 80% \n confidence regions', fontsize=10) plt.axis('off') plt.colorbar(shrink=.8) - plt.subplot(1, 3, 3) - density.shape = ref_dim + plt.subplot(1, 2, 2) plt.imshow(density, interpolation='nearest') plt.title('Spatial density under h1', fontsize=10) plt.axis('off') plt.colorbar(shrink=.8) - return landmarks, hrois - ############################################################################### # Main script @@ -145,7 +92,7 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, [30, 20]]) ampli = np.array([5, 7, 6]) sjitter = 1.0 -betas = simul.surrogate_2d_dataset(n_subj=n_subjects, shape=shape, pos=pos, +stats = simul.surrogate_2d_dataset(n_subj=n_subjects, shape=shape, pos=pos, ampli=ampli, width=5.0) # set various parameters @@ -153,12 +100,22 @@ def make_bsa_2d(betas, threshold=3., sigma=5., prevalence_threshold=0, sigma = 4. / 1.5 prevalence_threshold = n_subjects * .25 prevalence_pval = 0.9 -verbose = 1 smin = 5 algorithm = 'co-occurrence' # 'density' +domain = grid_domain_from_shape(shape) + +# get the functional information +stats_ = np.array([np.ravel(stats[k]) for k in range(n_subjects)]).T + # run the algo -landmarks, hrois = make_bsa_2d( - betas, threshold, sigma, prevalence_threshold, prevalence_pval, smin, - algorithm=algorithm, verbose=verbose) +landmarks, hrois = compute_landmarks( + domain, stats_, sigma, prevalence_pval, prevalence_threshold, + threshold, smin, method='prior', algorithm=algorithm) + +display_landmarks_2d(landmarks, hrois, stats) +if landmarks is not None: + landmarks.show() + plt.show() + From f8095fa1313d03dc1a6a4500fd76575d3b798e66 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 14 May 2013 16:14:44 +0200 Subject: [PATCH 157/164] Updates of the doctrings --- .../bayesian_structural_analysis.py | 134 ++++++++++-------- nipy/labs/spatial_models/bsa_io.py | 34 ++--- nipy/labs/spatial_models/structural_bfls.py | 15 +- 3 files changed, 99 insertions(+), 84 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 3df2477674..346e780ab5 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -35,13 +35,12 @@ def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): Parameters ---------- - test: array pf shape(n_samples), + test: array of shape(n_samples), data that is assessed - learn: array pf shape(n_samples), optional + learn: array of shape(n_samples), optional, data to learn a mixture model defaults to learn - method: string, one of ['gauss_mixture', 'emp_null', 'gam_gauss', 'prior'] - optional + method: {'gauss_mixture', 'emp_null', 'gam_gauss', 'prior'}, optional, 'gauss_mixture' A Gaussian Mixture Model is used 'emp_null' a null mode is fitted to test 'gam_gauss' a Gamma-Gaussian mixture is used @@ -49,6 +48,8 @@ def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): alpha: float in the [0,1] range, optional, parameter that yields the prior probability that a region is active should be chosen close to 0 + verbose: int, optional, + verbosity mode Returns ------- @@ -81,7 +82,7 @@ def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, - method='gauss_mixture', verbose=0): + method='gauss_mixture'): """ Compute the individual regions that are real activation candidates Parameters @@ -94,23 +95,24 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, first level threshold smin: int, optional minimal size of the regions to validate them - method: string, one of ['prior', 'gauss_mixture', 'gam_gauss', 'emp_null'] - optional, - method that is used to estimate prior significance - verbose: verbosity mode, optional + method: {'gauss_mixture', 'emp_null', 'gam_gauss', 'prior'}, optional, + 'gauss_mixture' A Gaussian Mixture Model is used + 'emp_null' a null mode is fitted to test + 'gam_gauss' a Gamma-Gaussian mixture is used + 'prior' a hard-coded function is used Returns ------- hrois: list of nipy.labs.spatial_models.hroi.HierrachicalROI instances - that represent individual ROIs - let nr be the number of terminal regions across subjects - prior_h0, array of shape (nr) - the mixture-based prior probability - that the terminal regions are false positives - subjects, array of shape (nr) - the subject index associated with the terminal regions - coords, array of shape (nr, coord.shape[1]) - the coordinates of the of the terminal regions + that represent individual ROIs + let nr be the number of terminal regions across subjects + prior_h0: array of shape (nr), + the mixture-based prior probability + that the terminal regions are false positives + subjects: array of shape (nr), + the subject index associated with the terminal regions + coords: array of shape (nr, coord.shape[1]), + the coordinates of the of the terminal regions Fixme ----- @@ -161,7 +163,7 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, def _dpmm(coords, alpha, null_density, dof, prior_precision, prior_h0, subjects, sampling_coords=None, n_iter=1000, burnin=100, - co_clust=False, verbose=False): + co_clust=False): """Apply the dpmm analysis to compute clusters from regions coordinates """ from nipy.algorithms.clustering.imm import MixedIMM @@ -197,39 +199,47 @@ def _update_hroi_labels(hrois, new_labels): hrois[subject].set_roi_feature('label', us) -def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, +def _bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, prevalence_threshold, dof=10, alpha=.5, n_iter=1000, burnin=100, - algorithm='density', verbose=0): + algorithm='density'): """ Estimation of the population level model of activation density using dpmm and inference Parameters ---------- hrois: list of nipy.labs.spatial_models.hroi.HierarchicalROI instances - representing individual ROIs - Let nr be the number of terminal regions across subjects + representing individual ROIs + Let nr be the number of terminal regions across subjects prior_h0: array of shape (nr) - the mixture-based prior probability - that the terminal regions are true positives + mixture-based prior probability + that the terminal regions are true positives subjects: array of shape (nr) - the subject index associated with the terminal regions + subject index associated with the terminal regions coords: array of shape (nr, coord.shape[1]) - the coordinates of the of the terminal regions - sigma: float>0, - expected cluster scatter in the common space in units of coord + coordinates of the of the terminal regions + sigma: float > 0, + expected cluster scatter in the common space in units of coord prevalence_pval: float in the [0,1] interval, optional p-value of the prevalence test prevalence_threshold: float in the rannge [0,nsubj] - null hypothesis on region prevalence - algorithm, string, one of ['density', 'co_occurrence'], optional, - verbose=0, verbosity mode + null hypothesis on region prevalence + dof: float > 0, optional, + degrees of freedom of the prior + alpha: float > 0, optional, + creation parameter of the DPMM + niter: int, optional, + number of iterations of the DPMM + burnin: int, optional, + number of iterations of the DPMM + algorithm: {'density', 'co_occurrence'}, optional, + algorithm used in the DPMM inference Returns ------- - landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found - in inter-subject inference + landmarks: instance of sbf.LandmarkRegions + that describes the ROIs found in inter-subject inference If no such thing can be defined landmarks is set to None - hrois: List of nipy.labs.spatial_models.hroi.HierarchicalROI instances + hrois: List of nipy.labs.spatial_models.hroi.HierarchicalROI instances representing individual ROIs """ from nipy.algorithms.graph.field import field_from_coo_matrix_and_data @@ -305,7 +315,7 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, # that are represented in each one landmarks, new_labels = build_landmarks( domain, coords, subjects, np.array(components), 1 - prior_h0, - prevalence_pval, prevalence_threshold, sigma, verbose=verbose) + prevalence_pval, prevalence_threshold, sigma) # relabel the regions _update_hroi_labels(hrois, new_labels) @@ -320,42 +330,46 @@ def bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, def compute_landmarks( domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, - threshold=3.0, smin=5, method='prior', algorithm='density', verbose=0): - """ Compute the Bayesian Structural Activation paterns - simplified version + threshold=3.0, smin=5, method='prior', algorithm='density'): + """ Compute the Bayesian Structural Activation patterns Parameters ---------- - domain : StructuredDomain instance, - Description of the spatial context of the data - stats: an array of shape (nbnodes, subjects): + domain: StructuredDomain instance, + Description of the spatial context of the data + stats: array of shape (nbnodes, subjects): the multi-subject statistical maps - sigma float>0: - expected cluster std in the common space in units of coord - prevalence_pval = 0.5 (float): - posterior significance threshold - should be in the [0,1] interval - smin = 5 (int): minimal size of the regions to validate them - threshold = 3.0 (float): first level threshold - method: string, optional, - the method used to assess the prior significance of the regions + sigma: float > 0: + expected cluster std in the common space in units of coord + prevalence_pval: float in the [0,1] interval, optional + posterior significance threshold + prevalence_threshold: float, optional, + reference threshold for the prevalence value + threshold: float, optional, + first level threshold + smin: int, optional, + minimal size of the regions to validate them + method: {'gauss_mixture', 'emp_null', 'gam_gauss', 'prior'}, optional, + 'gauss_mixture' A Gaussian Mixture Model is used + 'emp_null' a null mode is fitted to test + 'gam_gauss' a Gamma-Gaussian mixture is used + 'prior' a hard-coded function is used algorithm: string, one of ['density', 'co-occurrence'], optional method used to compute the landmarks - verbose=0: verbosity mode Returns ------- - landmarks: a instance of sbf.LandmarkRegions that describes the ROIs found - in inter-subject inference - If no such thing can be defined landmarks is set to None - hrois: List of nipy.labs.spatial_models.hroi.Nroi instances - representing individual ROIs + landmarks: Instance of sbf.LandmarkRegions or None, + Describes the ROIs found in inter-subject inference + None if nothing can be defined + hrois: list of nipy.labs.spatial_models.hroi.Nroi instances + representing individual ROIs """ hrois, prior_h0, subjects, coords = _compute_individual_regions( - domain, stats, threshold, smin, method, verbose) + domain, stats, threshold, smin, method) - landmarks, hrois = bsa_dpmm( + landmarks, hrois = _bsa_dpmm( hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, algorithm=algorithm, verbose=verbose) + prevalence_threshold, algorithm=algorithm) return landmarks, hrois diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 7f4d54670f..dfd0fe0fd0 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -23,37 +23,37 @@ def make_bsa_image( Parameters ---------- - mask_images: A list of image paths that yield binary images, - one for each subject - stat_images: A list of image paths that yields the activation images, - one for each subject + mask_images: list of str, + image paths that yield mask images, one for each subject + stat_images: list of str, + image paths of the activation images, one for each subject threshold: float, optional, - threshold used to ignore all the image data that si below - sigma: float, optional + threshold used to ignore all the image data that is below + smin: float, optional, + minimal size (in voxels) of the extracted blobs + smaller blobs are merged into larger ones + sigma: float, optional, variance of the spatial model, i.e. cross-subject uncertainty prevalence_threshold: float, optional threshold on the representativity measure - prevalence_pval: float, optional + prevalence_pval: float, optional, p-value of the representativity test: test = p(representativity>prevalence_threshold) > prevalence_pval - smin: float, optional - minimal size (in voxels) of the extracted blobs - smaller blobs are merged into larger ones - write_dir: string, optional + write_dir: string, optional, if not None, output directory - method: string, one of ['density', 'co-occurrence'], optional, - applied region detection method; to be chose among + method: {'density', 'co-occurrence'}, optional, + Inference method used in the landmark definition contrast_id: string, optional, identifier of the contrast Returns ------- - landmarks: an nipy.labs.spatial_models.structural_bfls.landmark_regions - instance that describes the structures found at the group level + landmarks: nipy.labs.spatial_models.structural_bfls.landmark_regions + instance that describes the structures found at the group level None is returned if nothing has been found significant at the group level - hrois : a list of nipy.labs.spatial_models.hroi.Nroi instances - (one per subject) that describe the individual coounterpart of landmarks + hrois : list of nipy.labs.spatial_models.hroi.Nroi instances, + (one per subject), describe the individual counterpart of landmarks fixme ===== diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index 2d53e5e0a0..c085965748 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -183,8 +183,7 @@ def roi_prevalence(self, fid='confidence'): def build_landmarks(domain, coords, subjects, labels, confidence=None, - prevalence_pval=0.95, prevalence_threshold=0, sigma=1., - verbose=0): + prevalence_pval=0.95, prevalence_threshold=0, sigma=1.): """ Given a list of hierarchical ROIs, and an associated labelling, this creates an Amer structure wuch groups ROIs with the same label. @@ -199,6 +198,8 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, indicators of the dataset the objects come from labels: array of shape (n), dtype = np.int index of the landmark the object is associated with + confidence: array of shape (n), + measure of the significance of the regions prevalence_pval: float, optional prevalence_threshold: float, optional, (c) A label should be present in prevalence_threshold @@ -210,11 +211,11 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, Returns ------- LR : None or structural_bfls.LR instance - describing a cross-subject set of ROIs. If inference yields a null - result, LR is set to None - newlabel: a relabelling of the individual ROIs, similar to u, - which discards - labels that do not fulfill the condition (c) + describing a cross-subject set of ROIs. If inference yields a null + result, LR is set to None + newlabel: array of shape (n) + a relabelling of the individual ROIs, similar to u, + that discards labels that do not fulfill the condition (c) """ if confidence is None: confidence = np.ones(labels.size) From 05ee837ce57fb396b5653eb866e07a78e95b8cc5 Mon Sep 17 00:00:00 2001 From: bthirion Date: Tue, 14 May 2013 19:22:51 +0200 Subject: [PATCH 158/164] increased test coverage + faster tests --- .../algorithms/statistics/empirical_pvalue.py | 10 ++--- .../bayesian_structural_analysis.py | 12 ++++-- nipy/labs/spatial_models/structural_bfls.py | 6 +-- nipy/labs/spatial_models/tests/test_bsa.py | 39 ++++++++++++++++--- 4 files changed, 48 insertions(+), 19 deletions(-) diff --git a/nipy/algorithms/statistics/empirical_pvalue.py b/nipy/algorithms/statistics/empirical_pvalue.py index f512897b5f..09c701544c 100644 --- a/nipy/algorithms/statistics/empirical_pvalue.py +++ b/nipy/algorithms/statistics/empirical_pvalue.py @@ -206,17 +206,15 @@ def learn(self, left=0.2, right=0.8): medge = ledge + 0.5 * step # remove null bins - whist = hist > 0 - hist = hist[whist] - medge = medge[whist] - hist = hist.astype('f') + hist, medge = hist[hist > 0].astype(np.float), medge[hist > 0] # fit the histogram - dmtx = np.ones((3, np.sum(whist))) + dmtx = np.ones((3, len(hist))) dmtx[1] = medge dmtx[2] = medge ** 2 coef = np.dot(np.log(hist), pinv(dmtx)) - sqsigma = -1.0 / (2 * coef[2]) + sqsigma = - 1.0 / (2 * coef[2]) + sqsigma = max(sqsigma, 1.e-6) mu = coef[1] * sqsigma lp0 = (coef[0] - np.log(step * self.n) + 0.5 * np.log(2 * np.pi * sqsigma) + mu ** 2 / (2 * sqsigma)) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 346e780ab5..6f567d755d 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -330,7 +330,8 @@ def _bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, def compute_landmarks( domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, - threshold=3.0, smin=5, method='prior', algorithm='density'): + threshold=3.0, smin=5, method='prior', algorithm='density', n_iter=1000, + burnin=100): """ Compute the Bayesian Structural Activation patterns Parameters @@ -356,7 +357,11 @@ def compute_landmarks( 'prior' a hard-coded function is used algorithm: string, one of ['density', 'co-occurrence'], optional method used to compute the landmarks - + niter: int, optional, + number of iterations of the DPMM + burnin: int, optional, + number of iterations of the DPMM + Returns ------- landmarks: Instance of sbf.LandmarkRegions or None, @@ -370,6 +375,7 @@ def compute_landmarks( landmarks, hrois = _bsa_dpmm( hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, algorithm=algorithm) + prevalence_threshold, algorithm=algorithm, n_iter=n_iter, + burnin=burnin) return landmarks, hrois diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index c085965748..bc3b1cb863 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -155,11 +155,7 @@ def show(self): print i, prevalence[i], centers[i], np.unique(subjects[i]) def roi_prevalence(self, fid='confidence'): - """ - assuming that fid='confidence' field has been set - as a discrete feature, - this creates the expectancy of the confidence measure - i.e. expected numberof detection of the roi in the observed group + """ Return a confidence index over the different rois Returns ------- diff --git a/nipy/labs/spatial_models/tests/test_bsa.py b/nipy/labs/spatial_models/tests/test_bsa.py index e8b1a09e65..111dbf3aaa 100644 --- a/nipy/labs/spatial_models/tests/test_bsa.py +++ b/nipy/labs/spatial_models/tests/test_bsa.py @@ -11,15 +11,15 @@ import scipy.stats as st from nose.tools import assert_true -from nipy.testing import dec +from nipy.testing import dec, assert_array_equal from ...utils.simul_multisubject_fmri_dataset import surrogate_2d_dataset -from ..bayesian_structural_analysis import compute_landmarks +from ..bayesian_structural_analysis import compute_landmarks, _signal_to_pproba from ..discrete_domain import domain_from_binary_array -def make_bsa_2d(betas, theta=3., sigma=5., ths=0, thq=0.5, smin=0, - nbeta=[0], algorithm='density'): +def make_bsa_2d(betas, theta=3., sigma=5., ths=0, thq=0.5, smin=3, + algorithm='density'): """ Function for performing bayesian structural analysis on a set of images. """ @@ -33,7 +33,7 @@ def make_bsa_2d(betas, theta=3., sigma=5., ths=0, thq=0.5, smin=0, dom = domain_from_binary_array(np.ones(ref_dim)) AF, BF = compute_landmarks(dom, lbeta, sigma, thq, ths, theta, smin, - algorithm=algorithm) + algorithm=algorithm, n_iter=100, burnin=10) return AF, BF @@ -74,6 +74,7 @@ def test_bsa_methods(): # (name_of_method, ths_value, data_set, test_function) algs_tests = ( ('density', half_subjs, null_betas, lambda AF, BF: AF.k == 0), + ('co-occurrence', half_subjs, null_betas, lambda AF, BF: AF.k == 0), ('density', 1, pos_betas, lambda AF, BF: AF.k > 1)) for name, ths, betas, test_func in algs_tests: @@ -81,6 +82,34 @@ def test_bsa_methods(): AF, BF = make_bsa_2d(betas, theta, sigma, ths, thq, smin, algorithm=name) yield assert_true, test_func(AF, BF) + + assert_true(AF.map_label().shape == (np.prod(shape),)) + assert_true(AF.kernel_density().shape == (np.prod(shape),)) + + +def test_pproba(): + test = 5 * np.random.rand(10) + order = np.argsort(-test) + learn = np.random.rand(100) + learn[:20] += 3 + # + pval = _signal_to_pproba(test) + # check that pvals are between 0 and 1, and that its is monotonous + assert_true((pval >= 0).all()) + assert_true((pval <= 1).all()) + assert_array_equal(pval[order], np.sort(pval)) + # + pval = _signal_to_pproba(test, learn) + assert_true((pval >= 0).all()) + assert_true((pval <= 1).all()) + assert_array_equal(pval[order], np.sort(pval)) + # + for method in ['gauss_mixture', 'emp_null', 'gam_gauss']: + pval = _signal_to_pproba(test, learn, method=method) + assert_true((pval >= 0).all()) + assert_true((pval <= 1).all()) + # assert_array_equal(pval[order], np.sort(pval), 6) + if __name__ == '__main__': From 0363f9c4fca690bcd182b44ba891fa8a2d0bd8f1 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 15 May 2013 00:38:06 +0200 Subject: [PATCH 159/164] Fixed a remote bug triggered by travis... --- nipy/algorithms/clustering/ggmixture.py | 6 ++++-- nipy/algorithms/statistics/empirical_pvalue.py | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/nipy/algorithms/clustering/ggmixture.py b/nipy/algorithms/clustering/ggmixture.py index a5de354521..21aec7c9fc 100644 --- a/nipy/algorithms/clustering/ggmixture.py +++ b/nipy/algorithms/clustering/ggmixture.py @@ -640,10 +640,12 @@ def show(self, x, mpaxes=None): mpaxes: matplotlib axes, optional axes handle used for the plot if None, new axes are created. """ + import matplotlib.pylab as mp + step = 3.5 * np.std(x) / np.exp(np.log(np.size(x)) / 3) bins = max(10, int((x.max() - x.min()) / step)) h, c = np.histogram(x, bins) - h = h.astype('d') / np.size(x) + h = h.astype(np.float) / np.size(x) dc = c[1] - c[0] ng = self.mixt[0] * _gam_dens(self.shape_n, self.scale_n, - c) @@ -651,12 +653,12 @@ def show(self, x, mpaxes=None): pg = self.mixt[2] * _gam_dens(self.shape_p, self.scale_p, c) z = y + pg + ng - import matplotlib.pylab as mp if mpaxes == None: mp.figure() ax = mp.subplot(1, 1, 1) else: ax = mpaxes + ax.plot(0.5 * (c[1:] + c[:-1]), h / dc, linewidth=2, label='data') ax.plot(c, ng, 'c', linewidth=2, label='negative gamma component') ax.plot(c, y, 'r', linewidth=2, label='Gaussian component') diff --git a/nipy/algorithms/statistics/empirical_pvalue.py b/nipy/algorithms/statistics/empirical_pvalue.py index 09c701544c..0b43cc3b58 100644 --- a/nipy/algorithms/statistics/empirical_pvalue.py +++ b/nipy/algorithms/statistics/empirical_pvalue.py @@ -492,7 +492,7 @@ def three_classes_GMM_fit(x, test=None, alpha=0.01, prior_strength=100, return bfp, BayesianGMM -def gamma_gaussian_fit(x, test=None, verbose=0, mpaxes=None, +def gamma_gaussian_fit(x, test=None, verbose=0, mpaxes=False, bias=1, gaussian_mix=0, return_estimator=False): """ Computing some prior probabilities that the voxels of a certain map @@ -508,9 +508,10 @@ def gamma_gaussian_fit(x, test=None, verbose=0, mpaxes=None, verbose: 0, 1 or 2, optional verbosity mode, 0 is quiet, and 2 calls matplotlib to display graphs. - mpaxes: matplotlib axes, option. + mpaxes: matplotlib axes, optional axes handle used to plot the figure in verbose mode if None, new axes are created + if false, nothing is done bias: float, optional lower bound on the Gaussian variance (to avoid shrinkage) gaussian_mix: float, optional @@ -532,7 +533,7 @@ def gamma_gaussian_fit(x, test=None, verbose=0, mpaxes=None, Ggg = ggmixture.GGGM() Ggg.init_fdr(x) Ggg.estimate(x, niter=100, delta=1.e-8, bias=bias, verbose=0, - gaussian_mix=gaussian_mix) + gaussian_mix=gaussian_mix) if mpaxes is not False: # hyper-verbose mode Ggg.show(x, mpaxes=mpaxes) From b9d0ed9ed44e34d383832e47fd83caa1a0515a9a Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 15 May 2013 00:38:29 +0200 Subject: [PATCH 160/164] Further simplifcations of the cade + more tests --- .../bayesian_structural_analysis.py | 4 +- nipy/labs/spatial_models/bsa_io.py | 19 +++-- nipy/labs/spatial_models/structural_bfls.py | 76 ++++++++----------- nipy/labs/spatial_models/tests/test_bsa.py | 9 ++- 4 files changed, 51 insertions(+), 57 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 6f567d755d..1354520fa9 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -29,7 +29,7 @@ #################################################################### -def _signal_to_pproba(test, learn=None, method='prior', alpha=0.01, verbose=0): +def _stat_to_proba(test, learn=None, method='prior', alpha=0.01, verbose=0): """Convert a set of statistics to posterior probabilities of being generated under H0 @@ -147,7 +147,7 @@ def _compute_individual_regions(domain, stats, threshold=3.0, smin=5, # compute the prior proba of being null learning_set = np.squeeze(stats_[stats_ != 0]) - prior_h0.append(_signal_to_pproba(mean_val, learning_set, method)) + prior_h0.append(_stat_to_proba(mean_val, learning_set, method)) subjects.append(subject * np.ones(mean_val.size).astype(np.int)) else: subjects.append([]) diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index dfd0fe0fd0..8f7aeb587e 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -17,7 +17,7 @@ def make_bsa_image( mask_images, stat_images, threshold=3., smin=0, sigma=5., prevalence_threshold=0, prevalence_pval=0.5, write_dir=None, - algorithm='density', contrast_id='default', verbose=0): + algorithm='density', contrast_id='default'): """ Main function for performing bsa on a set of images. It creates the some output images in the given directory @@ -54,20 +54,23 @@ def make_bsa_image( at the group level hrois : list of nipy.labs.spatial_models.hroi.Nroi instances, (one per subject), describe the individual counterpart of landmarks - - fixme - ===== - unique mask should be allowed """ n_subjects = len(stat_images) # Read the referential information - nim = load(mask_images[0]) + nim = load(stat_images[0]) ref_dim = nim.shape[:3] affine = nim.get_affine() # Read the masks and compute the "intersection" - mask = np.reshape(intersect_masks(mask_images), ref_dim).astype('u8') + # mask = np.reshape(intersect_masks(mask_images), ref_dim).astype('u8') + if isinstance(mask_images, basestring): + mask = load(mask_images).get_data() + elif isinstance(mask_images, Nifti1Image): + mask = mask_images.get_data() + else: + # mask_images should be a list of strings or images + mask = intersect_masks(mask_images).astype('u8') # encode it as a domain domain = domain_from_image(Nifti1Image(mask, affine), nn=18) @@ -90,7 +93,7 @@ def make_bsa_image( landmarks, hrois = compute_landmarks( domain, stats, sigma, prevalence_pval, prevalence_threshold, - threshold, smin, algorithm=algorithm, verbose=verbose) + threshold, smin, algorithm=algorithm) if landmarks is not None: crmap = landmarks.map_label(domain.coord, 0.95, sigma) diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index bc3b1cb863..ed04994541 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -38,45 +38,41 @@ class LandmarkRegions(object): not implemented yet. """ - def __init__(self, domain, k, indiv_coord, subjects, id=''): + def __init__(self, domain, k, indiv_coord, subjects, confidence): """ Building the landmark_region Parameters ---------- domain: ROI instance defines the spatial context of the SubDomains - k: int, the number of regions considered - indiv_coord: k-length list of arrays, optional, + k: int, + the number of landmark regions considered + indiv_coord: k-length list of arrays, coordinates of the nodes in some embedding space. subjects: k-length list of integers - these correspond to and ROI feature: + these correspond to an ROI feature: the subject index of individual regions - - id: string, optional, identifier + confidence: k-length list of arrays, + confidence values for the regions (0 is low, 1 is high) """ self.domain = domain self.k = int(k) - self.id = id - self.features = {} - self.set_feature('position', indiv_coord) - self.set_feature('subjects', subjects) - - def set_feature(self, fid, data): - """ - """ - if len(data) != self.k: - raise ValueError('data should have length k') - self.features.update({fid: data}) - - def get_feature(self, fid): - return self.features[fid] + if len(indiv_coord) != k: + raise ValueError('len(indiv_coord) should be equal to %d' % k) + if len(subjects) != k: + raise ValueError('len(subjects) should be equal to %d' % k) + if len(confidence) != k: + raise ValueError('len(confidence) should be equal to %d' % k) + self.position = indiv_coord + self.subjects = subjects + self.confidence = confidence def centers(self): """returns the average of the coordinates for each region """ - pos = self.get_feature('position') - centers = np.array([np.mean(pos[k], 0) for k in range(self.k)]) - return centers + pos = self.position + centers_ = np.array([np.mean(pos[k], 0) for k in range(self.k)]) + return centers_ def kernel_density(self, k=None, coord=None, sigma=1.): """ Compute the density of a component as a kde @@ -102,12 +98,12 @@ def kernel_density(self, k=None, coord=None, sigma=1.): if k == None: kde = np.zeros(coord.shape[0]) for k in range(self.k): - pos = self.get_feature('position')[k] + pos = self.position[k] dist = euclidean_distance(pos, coord) kde += np.exp(- dist ** 2 / (2 * sigma ** 2)).sum(0) else: k = int(k) - pos = self.get_feature('position')[k] + pos = self.position[k] dist = euclidean_distance(pos, coord) kde = np.exp(- dist ** 2 / (2 * sigma ** 2)).sum(0) return kde / (2 * np.pi * sigma ** 2) ** (pos.shape[1] / 2) @@ -148,13 +144,13 @@ def show(self): """function to print basic information on self """ centers = self.centers() - subjects = self.get_feature('subjects') + subjects = self.subjects prevalence = self.roi_prevalence() print "index", "prevalence", "mean_position", "individuals" for i in range(self.k): print i, prevalence[i], centers[i], np.unique(subjects[i]) - def roi_prevalence(self, fid='confidence'): + def roi_prevalence(self): """ Return a confidence index over the different rois Returns @@ -162,20 +158,15 @@ def roi_prevalence(self, fid='confidence'): confid: array of shape self.k the population_prevalence """ - confid = np.zeros(self.k) - subjects = self.get_feature('subjects') - if fid not in self.features: - for j in range(self.k): - subjj = subjects[j] - confid[j] = np.size(np.unique(subjj)) - else: - for j in range(self.k): - subjj = subjects[j] - conf = self.get_feature(fid)[j] - for ls in np.unique(subjj): - lmj = 1 - np.prod(1 - conf[subjj == ls]) - confid[j] += lmj - return confid + prevalence_ = np.zeros(self.k) + subjects = self.subjects + for j in range(self.k): + subjj = subjects[j] + conf = self.confidence[j] + for ls in np.unique(subjj): + lmj = 1 - np.prod(1 - conf[subjj == ls]) + prevalence_[j] += lmj + return prevalence_ def build_landmarks(domain, coords, subjects, labels, confidence=None, @@ -255,6 +246,5 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, # create the landmark regions structure LR = LandmarkRegions(domain, np.sum(valid), indiv_coord=coordinates, - subjects=subjs) - LR.set_feature('confidence', pps) + subjects=subjs, confidence=pps) return LR, maplabel diff --git a/nipy/labs/spatial_models/tests/test_bsa.py b/nipy/labs/spatial_models/tests/test_bsa.py index 111dbf3aaa..c9b33835e7 100644 --- a/nipy/labs/spatial_models/tests/test_bsa.py +++ b/nipy/labs/spatial_models/tests/test_bsa.py @@ -14,7 +14,7 @@ from nipy.testing import dec, assert_array_equal from ...utils.simul_multisubject_fmri_dataset import surrogate_2d_dataset -from ..bayesian_structural_analysis import compute_landmarks, _signal_to_pproba +from ..bayesian_structural_analysis import compute_landmarks, _stat_to_proba from ..discrete_domain import domain_from_binary_array @@ -85,6 +85,7 @@ def test_bsa_methods(): assert_true(AF.map_label().shape == (np.prod(shape),)) assert_true(AF.kernel_density().shape == (np.prod(shape),)) + assert_true((AF.roi_prevalence() > ths).all()) def test_pproba(): @@ -93,19 +94,19 @@ def test_pproba(): learn = np.random.rand(100) learn[:20] += 3 # - pval = _signal_to_pproba(test) + pval = _stat_to_proba(test) # check that pvals are between 0 and 1, and that its is monotonous assert_true((pval >= 0).all()) assert_true((pval <= 1).all()) assert_array_equal(pval[order], np.sort(pval)) # - pval = _signal_to_pproba(test, learn) + pval = _stat_to_proba(test, learn) assert_true((pval >= 0).all()) assert_true((pval <= 1).all()) assert_array_equal(pval[order], np.sort(pval)) # for method in ['gauss_mixture', 'emp_null', 'gam_gauss']: - pval = _signal_to_pproba(test, learn, method=method) + pval = _stat_to_proba(test, learn, method=method) assert_true((pval >= 0).all()) assert_true((pval <= 1).all()) # assert_array_equal(pval[order], np.sort(pval), 6) From 10135956989cd7bd0fb600c57450fdd00b77df90 Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 15 May 2013 00:38:52 +0200 Subject: [PATCH 161/164] added tests for bsa_io --- nipy/labs/spatial_models/tests/test_bsa_io.py | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 nipy/labs/spatial_models/tests/test_bsa_io.py diff --git a/nipy/labs/spatial_models/tests/test_bsa_io.py b/nipy/labs/spatial_models/tests/test_bsa_io.py new file mode 100644 index 0000000000..f7c4b93a5f --- /dev/null +++ b/nipy/labs/spatial_models/tests/test_bsa_io.py @@ -0,0 +1,44 @@ +from __future__ import with_statement +from nose.tools import assert_true +from os.path import exists +import numpy as np +from nibabel import Nifti1Image +from numpy.testing import assert_equal +from ...utils.simul_multisubject_fmri_dataset import surrogate_3d_dataset +from ..bsa_io import make_bsa_image +from nibabel.tmpdirs import InTemporaryDirectory + + +def test_parcel_intra_from_3d_images_list(): + """Test that a parcellation is generated, starting from a list of 3D images + """ + # Generate an image + shape = (5, 5, 5) + contrast_id = 'plop' + mask_image = Nifti1Image(np.ones(shape), np.eye(4)) + #mask_images = [mask_image for _ in range(5)] + + with InTemporaryDirectory() as dir_context: + data_image = ['image_%d.nii' % i for i in range(5)] + for datim in data_image: + surrogate_3d_dataset(mask=mask_image, out_image_file=datim) + + #run the algo + landmark, hrois = make_bsa_image( + mask_image, data_image, threshold=10., smin=0, sigma=1., + prevalence_threshold=0, prevalence_pval=0.5, write_dir=dir_context, + algorithm='density', contrast_id=contrast_id) + + assert_equal(landmark, None) + assert_equal(len(hrois), 5) + assert_true(exists('density_%s.nii' % contrast_id)) + assert_true(exists('prevalence_%s.nii' % contrast_id)) + assert_true(exists('AR_%s.nii' % contrast_id)) + assert_true(exists('CR_%s.nii' % contrast_id)) + + + + +if __name__ == "__main__": + import nose + nose.run(argv=['', __file__]) From ecaed2c3c890e8344d8dacbc1f4365e10d1a46ba Mon Sep 17 00:00:00 2001 From: bthirion Date: Wed, 15 May 2013 15:17:15 +0200 Subject: [PATCH 162/164] pep8 + a little fix --- .../spatial_models/bayesian_structural_analysis.py | 10 +++++----- nipy/labs/spatial_models/bsa_io.py | 2 +- nipy/labs/spatial_models/structural_bfls.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nipy/labs/spatial_models/bayesian_structural_analysis.py b/nipy/labs/spatial_models/bayesian_structural_analysis.py index 1354520fa9..36ba264906 100644 --- a/nipy/labs/spatial_models/bayesian_structural_analysis.py +++ b/nipy/labs/spatial_models/bayesian_structural_analysis.py @@ -236,7 +236,7 @@ def _bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, Returns ------- - landmarks: instance of sbf.LandmarkRegions + landmarks: instance of sbf.LandmarkRegions that describes the ROIs found in inter-subject inference If no such thing can be defined landmarks is set to None hrois: List of nipy.labs.spatial_models.hroi.HierarchicalROI instances @@ -330,7 +330,7 @@ def _bsa_dpmm(hrois, prior_h0, subjects, coords, sigma, prevalence_pval, def compute_landmarks( domain, stats, sigma, prevalence_pval=0.5, prevalence_threshold=0, - threshold=3.0, smin=5, method='prior', algorithm='density', n_iter=1000, + threshold=3.0, smin=5, method='prior', algorithm='density', n_iter=1000, burnin=100): """ Compute the Bayesian Structural Activation patterns @@ -348,7 +348,7 @@ def compute_landmarks( reference threshold for the prevalence value threshold: float, optional, first level threshold - smin: int, optional, + smin: int, optional, minimal size of the regions to validate them method: {'gauss_mixture', 'emp_null', 'gam_gauss', 'prior'}, optional, 'gauss_mixture' A Gaussian Mixture Model is used @@ -361,7 +361,7 @@ def compute_landmarks( number of iterations of the DPMM burnin: int, optional, number of iterations of the DPMM - + Returns ------- landmarks: Instance of sbf.LandmarkRegions or None, @@ -375,7 +375,7 @@ def compute_landmarks( landmarks, hrois = _bsa_dpmm( hrois, prior_h0, subjects, coords, sigma, prevalence_pval, - prevalence_threshold, algorithm=algorithm, n_iter=n_iter, + prevalence_threshold, algorithm=algorithm, n_iter=n_iter, burnin=burnin) return landmarks, hrois diff --git a/nipy/labs/spatial_models/bsa_io.py b/nipy/labs/spatial_models/bsa_io.py index 8f7aeb587e..46795cdb5e 100644 --- a/nipy/labs/spatial_models/bsa_io.py +++ b/nipy/labs/spatial_models/bsa_io.py @@ -96,7 +96,7 @@ def make_bsa_image( threshold, smin, algorithm=algorithm) if landmarks is not None: - crmap = landmarks.map_label(domain.coord, 0.95, sigma) + crmap = landmarks.map_label(domain.coord, 0.95, sigma).astype(np.int16) density = landmarks.kernel_density( k=None, coord=domain.coord, sigma=sigma) default_idx = landmarks.k + 2 diff --git a/nipy/labs/spatial_models/structural_bfls.py b/nipy/labs/spatial_models/structural_bfls.py index ed04994541..85dfae9fc6 100644 --- a/nipy/labs/spatial_models/structural_bfls.py +++ b/nipy/labs/spatial_models/structural_bfls.py @@ -45,7 +45,7 @@ def __init__(self, domain, k, indiv_coord, subjects, confidence): ---------- domain: ROI instance defines the spatial context of the SubDomains - k: int, + k: int, the number of landmark regions considered indiv_coord: k-length list of arrays, coordinates of the nodes in some embedding space. @@ -186,7 +186,7 @@ def build_landmarks(domain, coords, subjects, labels, confidence=None, labels: array of shape (n), dtype = np.int index of the landmark the object is associated with confidence: array of shape (n), - measure of the significance of the regions + measure of the significance of the regions prevalence_pval: float, optional prevalence_threshold: float, optional, (c) A label should be present in prevalence_threshold From 4293f542fbf5ca6ab328648c4425c73d8be9b63e Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Wed, 22 May 2013 11:09:00 -0700 Subject: [PATCH 163/164] DOC: update sourceforge links to nipy.org because we're set up properly on nipy.org now. --- doc/_templates/layout.html | 6 +++--- doc/users/install_data.rst | 8 ++++---- nipy/info.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/_templates/layout.html b/doc/_templates/layout.html index 938ef34561..bb860bb9f8 100644 --- a/doc/_templates/layout.html +++ b/doc/_templates/layout.html @@ -31,13 +31,13 @@

Site Navigation

NIPY Community

Github repo

diff --git a/doc/users/install_data.rst b/doc/users/install_data.rst index 4771b88f00..93eaade7b4 100644 --- a/doc/users/install_data.rst +++ b/doc/users/install_data.rst @@ -7,7 +7,7 @@ Optional data packages The source code has some very small data files to run the tests with, but it doesn't include larger example data files, or the all-important brain templates we all use. You can find packages for the optional data -and template files at http://nipy.sourceforge.net/data-packages. +and template files at http://nipy.org/data-packages. If you don't have these packages, then, when you run nipy installation, you will probably see messages pointing you to the packages you need. @@ -18,12 +18,12 @@ Data package installation as an administrator The installation procedure, for now, is very basic. For example, let us say that you need the 'nipy-templates' package at -http://nipy.sourceforge.net/data-packages/nipy-templates-0.2.tar.gz +http://nipy.org/data-packages/nipy-templates-0.2.tar.gz . You simply download this archive, unpack it, and then run the standard ``python setup.py install`` on it. On a unix system this might look like:: - curl -O http://nipy.sourceforge.net/data-packages/nipy-templates-0.2.tar.gz + curl -O http://nipy.org/data-packages/nipy-templates-0.2.tar.gz tar zxvf nipy-templates-0.2.tar.gz cd nipy-templates-0.2 sudo python setup.py install @@ -58,7 +58,7 @@ things from Windows powershell. mkdir ~/.nipy/nipy -* Go to http://nipy.sourceforge.net/data-packages +* Go to http://nipy.org/data-packages * Download the latest *nipy-templates* and *nipy-data* packages * Unpack both these into some directory, e.g.:: diff --git a/nipy/info.py b/nipy/info.py index 323d8d7694..9acd79bf68 100644 --- a/nipy/info.py +++ b/nipy/info.py @@ -150,7 +150,7 @@ CYTHON_MIN_VERSION = '0.12.1' # Versions and locations of optional data packages -NIPY_DATA_URL= 'http://nipy.sourceforge.net/data-packages/' +NIPY_DATA_URL= 'http://nipy.org/data-packages/' DATA_PKGS = {'nipy-data': {'min version':'0.2', 'relpath':'nipy/data'}, 'nipy-templates': {'min version':'0.2', From 154c2e718b42c5820bcb36ad4a657804b0707291 Mon Sep 17 00:00:00 2001 From: Jonathan Taylor Date: Mon, 10 Jun 2013 11:38:38 -0700 Subject: [PATCH 164/164] ds105 fmri example with single runs being fit --- examples/ds105/ds105_example.py | 525 ++++++++++++++++++++++++++++ examples/ds105/ds105_util.py | 292 ++++++++++++++++ examples/ds105/parallel_run.py | 136 +++++++ examples/ds105/view_contrasts_3d.py | 74 ++++ nipy/modalities/fmri/design.py | 130 ++++++- 5 files changed, 1153 insertions(+), 4 deletions(-) create mode 100644 examples/ds105/ds105_example.py create mode 100644 examples/ds105/ds105_util.py create mode 100644 examples/ds105/parallel_run.py create mode 100755 examples/ds105/view_contrasts_3d.py diff --git a/examples/ds105/ds105_example.py b/examples/ds105/ds105_example.py new file mode 100644 index 0000000000..365dd08797 --- /dev/null +++ b/examples/ds105/ds105_example.py @@ -0,0 +1,525 @@ +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""Example analyzing the FIAC dataset with NIPY. + +* Single run models with per-voxel AR(1). +* Cross-run, within-subject models with optimal effect estimates. +* Cross-subject models using fixed / random effects variance ratios. +* Permutation testing for inference on cross-subject result. + +See ``parallel_run.py`` for a rig to run these analysis in parallel using the +IPython parallel machinery. + +This script needs the pre-processed FIAC data. See ``README.txt`` and +``fiac_util.py`` for details. + +See ``examples/labs/need_data/first_level_fiac.py`` for an alternative approach +to some of these analyses. +""" +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility + +# Stdlib +from tempfile import NamedTemporaryFile +from os.path import join as pjoin +from copy import copy +import warnings + +# Third party +import numpy as np + +# From NIPY +from nipy.algorithms.statistics.api import (OLSModel, ARModel, make_recarray, + isestimable) +from nipy.modalities.fmri.fmristat import hrf as delay +from nipy.modalities.fmri import design, hrf +from nipy.io.api import load_image, save_image +from nipy.core import api +from nipy.core.api import Image +from nipy.core.image.image import rollimg + +from nipy.algorithms.statistics import onesample + +# Local +import ds105_util as futil +reload(futil) # while developing interactively + +#----------------------------------------------------------------------------- +# Globals +#----------------------------------------------------------------------------- + +SUBJECTS = tuple(range(1,7)) +RUNS = tuple(range(1, 13)) +DESIGNS = ('standard',) +CONTRASTS = ('speaker_0', 'speaker_1', + 'sentence_0', 'sentence_1', + 'sentence:speaker_0', + 'sentence:speaker_1') + +# XXX: this mask was copied by hand from one of the subjects +# we should have a function to create this mask from the ds105 data +GROUP_MASK = futil.load_image_ds105('group', 'mask.nii.gz') +TINY_MASK = np.zeros(GROUP_MASK.shape, np.bool) +TINY_MASK[30:32,40:42,30:32] = 1 + +#----------------------------------------------------------------------------- +# Public functions +#----------------------------------------------------------------------------- + +# For group analysis + +def run_model(subj, run): + """ + Single subject fitting of FIAC model + """ + #---------------------------------------------------------------------- + # Set initial parameters of the FIAC dataset + #---------------------------------------------------------------------- + # Number of volumes in the fMRI data + nvol = 121 + # The TR of the experiment + TR = 2.5 + # The time of the first volume + Tstart = 0.0 + # The array of times corresponding to each volume in the fMRI data + volume_times = np.arange(nvol) * TR + Tstart + # This recarray of times has one column named 't'. It is used in the + # function design.event_design to create the design matrices. + volume_times_rec = make_recarray(volume_times, 't') + # Get a path description dictionary that contains all the path data relevant + # to this subject/run + path_info = futil.path_info_run(subj,run) + + #---------------------------------------------------------------------- + # Experimental design + #---------------------------------------------------------------------- + + # Load the experimental description from disk. We have utilities in futil + # that reformat the original FIAC-supplied format into something where the + # factorial structure of the design is more explicit. This has already + # been run once, and get_experiment_initial() will simply load the + # newly-formatted design description files (.csv) into record arrays. + experiment = futil.get_experiment(path_info) + + # Create design matrices for the "initial" and "experiment" factors, saving + # the default contrasts. + + # The function event_design will create design matrices, which in the case + # of "experiment" will have num_columns = (# levels of speaker) * (# levels + # of sentence) * len(delay.spectral) = 2 * 2 * 2 = 8. For "initial", there + # will be (# levels of initial) * len([hrf.glover]) = 1 * 1 = 1. + + # Here, delay.spectral is a sequence of 2 symbolic HRFs that are described + # in: + # + # Liao, C.H., Worsley, K.J., Poline, J-B., Aston, J.A.D., Duncan, G.H., + # Evans, A.C. (2002). \'Estimating the delay of the response in fMRI + # data.\' NeuroImage, 16:593-606. + + # The contrast definitions in ``cons_exper`` are a dictionary with keys + # ['constant_0', 'constant_1', 'speaker_0', 'speaker_1', 'sentence_0', + # 'sentence_1', 'sentence:speaker_0', 'sentence:speaker_1'] representing the + # four default contrasts: constant, main effects + interactions, each + # convolved with 2 HRFs in delay.spectral. For example, sentence:speaker_0 + # is the interaction of sentence and speaker convolved with the first (=0) + # of the two HRF basis functions, and sentence:speaker_1 is the interaction + # convolved with the second (=1) of the basis functions. + + # XXX use the hrf __repr__ for naming contrasts + X_exper, cons_exper = design.block_design(experiment, volume_times_rec, + hrfs=delay.spectral, + level_contrasts=True) + + # In addition to factors, there is typically a "drift" term. In this case, + # the drift is a natural cubic spline with a not at the midpoint + # (volume_times.mean()) + vt = volume_times # shorthand + drift = np.array( [vt**i for i in range(4)] + + [(vt-vt.mean())**3 * (np.greater(vt, vt.mean()))] ) + for i in range(drift.shape[0]): + drift[i] /= drift[i].max() + + # We transpose the drift so that its shape is (nvol,5) so that it will have + # the same number of rows as X_exper. + drift = drift.T + + # There are helper functions to create these drifts: design.fourier_basis, + # design.natural_spline. Therefore, the above is equivalent (except for + # the normalization by max for numerical stability) to + # + # >>> drift = design.natural_spline(t, [volume_times.mean()]) + + # Stack all the designs, keeping the new contrasts which has the same keys + # as cons_exper, but its values are arrays with 15 columns, with the + # non-zero entries matching the columns of X corresponding to X_exper + X, cons = design.stack_designs((X_exper, cons_exper), + (drift, {})) + + # Sanity check: delete any non-estimable contrasts + for k in cons.keys(): + if not isestimable(cons[k], X): + del(cons[k]) + warnings.warn("contrast %s not estimable for this run" % k) + + # The default contrasts are all t-statistics. We may want to output + # F-statistics for 'speaker', 'sentence', 'speaker:sentence' based on the + # two coefficients, one for each HRF in delay.spectral + + # We reproduce the same constrasts as in the data base + # outputting an F using both HRFs, as well as the + # t using only the first HRF + + for obj1, obj2 in [('face', 'scrambled'), + ('house', 'scrambled'), + ('chair', 'scrambled'), + ('face', 'house')]: + cons['%s_vs_%s_F' % (obj1, obj2)] = \ + np.vstack([cons['object_%s_0' % obj1] - + cons['object_%s_0' % obj2], + cons['object_%s_1' % obj1] - + cons['object_%s_1' % obj2]]) + + + cons['%s_vs_%s_t' % (obj1, obj2)] = (cons['object_%s_0' % obj1] - + cons['object_%s_0' % obj2]) + + #---------------------------------------------------------------------- + # Data loading + #---------------------------------------------------------------------- + + # Load in the fMRI data, saving it as an array. It is transposed to have + # time as the first dimension, i.e. fmri[t] gives the t-th volume. + fmri_im = futil.get_fmri(path_info) # an Image + fmri_im = rollimg(fmri_im, 't') + fmri = fmri_im.get_data() # now, it's an ndarray + + nvol, volshape = fmri.shape[0], fmri.shape[1:] + nx, sliceshape = volshape[0], volshape[1:] + + #---------------------------------------------------------------------- + # Model fit + #---------------------------------------------------------------------- + + # The model is a two-stage model, the first stage being an OLS (ordinary + # least squares) fit, whose residuals are used to estimate an AR(1) + # parameter for each voxel. + m = OLSModel(X) + ar1 = np.zeros(volshape) + + # Fit the model, storing an estimate of an AR(1) parameter at each voxel + for s in range(nx): + d = np.array(fmri[:,s]) + flatd = d.reshape((d.shape[0], -1)) + result = m.fit(flatd) + ar1[s] = ((result.resid[1:] * result.resid[:-1]).sum(0) / + (result.resid**2).sum(0)).reshape(sliceshape) + + # We round ar1 to nearest one-hundredth and group voxels by their rounded + # ar1 value, fitting an AR(1) model to each batch of voxels. + + # XXX smooth here? + # ar1 = smooth(ar1, 8.0) + ar1 *= 100 + ar1 = ar1.astype(np.int) / 100. + + # We split the contrasts into F-tests and t-tests. + # XXX helper function should do this + fcons = {}; tcons = {} + for n, v in cons.items(): + v = np.squeeze(v) + if v.ndim == 1: + tcons[n] = v + else: + fcons[n] = v + + # Setup a dictionary to hold all the output + # XXX ideally these would be memmap'ed Image instances + output = {} + for n in tcons: + tempdict = {} + for v in ['sd', 't', 'effect']: + tempdict[v] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' + % (n,v)), dtype=np.float, + shape=volshape, mode='w+') + output[n] = tempdict + + for n in fcons: + output[n] = np.memmap(NamedTemporaryFile(prefix='%s%s.nii' + % (n,v)), dtype=np.float, + shape=volshape, mode='w+') + + # Loop over the unique values of ar1 + for val in np.unique(ar1): + armask = np.equal(ar1, val) + m = ARModel(X, val) + d = fmri[:,armask] + results = m.fit(d) + + # Output the results for each contrast + for n in tcons: + resT = results.Tcontrast(tcons[n]) + output[n]['sd'][armask] = resT.sd + output[n]['t'][armask] = resT.t + output[n]['effect'][armask] = resT.effect + for n in fcons: + output[n][armask] = results.Fcontrast(fcons[n]).F + + # Dump output to disk + odir = futil.output_dir(path_info,tcons,fcons) + # The coordmap for a single volume in the time series + vol0_map = fmri_im[0].coordmap + for n in tcons: + for v in ['t', 'sd', 'effect']: + im = Image(output[n][v], vol0_map) + save_image(im, pjoin(odir, n, '%s.nii' % v)) + for n in fcons: + im = Image(output[n], vol0_map) + save_image(im, pjoin(odir, n, "F.nii")) + + +def fixed_effects(subj, design): + """ Fixed effects (within subject) for FIAC model + + Finds run by run estimated model results, creates fixed effects results + image per subject. + + Parameters + ---------- + subj : int + subject number 1..6 inclusive + design : {'standard'} + design type + """ + # First, find all the effect and standard deviation images + # for the subject and this design type + path_dict = futil.path_info_design(subj, design) + rootdir = path_dict['rootdir'] + # The output directory + fixdir = pjoin(rootdir, "fixed") + # Fetch results images from run estimations + results = futil.results_table(path_dict) + # Get our hands on the relevant coordmap to save our results + coordmap = futil.load_image_fiac("_%02d" % subj, + "wanatomical.nii").coordmap + # Compute the "fixed" effects for each type of contrast + for con in results: + fixed_effect = 0 + fixed_var = 0 + for effect, sd in results[con]: + effect = load_image(effect).get_data() + sd = load_image(sd).get_data() + var = sd ** 2 + + # The optimal, in terms of minimum variance, combination of the + # effects has weights 1 / var + # + # XXX regions with 0 variance are set to 0 + # XXX do we want this or np.nan? + ivar = np.nan_to_num(1. / var) + fixed_effect += effect * ivar + fixed_var += ivar + + # Now, compute the fixed effects variance and t statistic + fixed_sd = np.sqrt(fixed_var) + isd = np.nan_to_num(1. / fixed_sd) + fixed_t = fixed_effect * isd + + # Save the results + odir = futil.ensure_dir(fixdir, con) + for a, n in zip([fixed_effect, fixed_sd, fixed_t], + ['effect', 'sd', 't']): + im = api.Image(a, copy(coordmap)) + save_image(im, pjoin(odir, '%s.nii' % n)) + + +def group_analysis(design, contrast): + """ Compute group analysis effect, t, sd for `design` and `contrast` + + Saves to disk in 'group' analysis directory + + Parameters + ---------- + design : {'block', 'event'} + contrast : str + contrast name + """ + array = np.array # shorthand + # Directory where output will be written + odir = futil.ensure_dir(futil.DATADIR, 'group', design, contrast) + + # Which subjects have this (contrast, design) pair? + subj_con_dirs = futil.subj_des_con_dirs(design, contrast) + if len(subj_con_dirs) == 0: + raise ValueError('No subjects for %s, %s' % (design, contrast)) + + # Assemble effects and sds into 4D arrays + sds = [] + Ys = [] + for s in subj_con_dirs: + sd_img = load_image(pjoin(s, "sd.nii")) + effect_img = load_image(pjoin(s, "effect.nii")) + sds.append(sd_img.get_data()) + Ys.append(effect_img.get_data()) + sd = array(sds) + Y = array(Ys) + + # This function estimates the ratio of the fixed effects variance + # (sum(1/sd**2, 0)) to the estimated random effects variance + # (sum(1/(sd+rvar)**2, 0)) where rvar is the random effects variance. + + # The EM algorithm used is described in: + # + # Worsley, K.J., Liao, C., Aston, J., Petre, V., Duncan, G.H., + # Morales, F., Evans, A.C. (2002). \'A general statistical + # analysis for fMRI data\'. NeuroImage, 15:1-15 + varest = onesample.estimate_varatio(Y, sd) + random_var = varest['random'] + + # XXX - if we have a smoother, use + # random_var = varest['fixed'] * smooth(varest['ratio']) + + # Having estimated the random effects variance (and possibly smoothed it), + # the corresponding estimate of the effect and its variance is computed and + # saved. + + # This is the coordmap we will use + coordmap = futil.load_image_fiac("fiac_00","wanatomical.nii").coordmap + + adjusted_var = sd**2 + random_var + adjusted_sd = np.sqrt(adjusted_var) + + results = onesample.estimate_mean(Y, adjusted_sd) + for n in ['effect', 'sd', 't']: + im = api.Image(results[n], copy(coordmap)) + save_image(im, pjoin(odir, "%s.nii" % n)) + + +def group_analysis_signs(design, contrast, mask, signs=None): + """ Refit the EM model with a vector of signs. + + Used in the permutation tests. + + Returns the maximum of the T-statistic within mask + + Parameters + ---------- + design: one of 'block', 'event' + contrast: str + name of contrast to estimate + mask : ``Image`` instance or array-like + image containing mask, or array-like + signs: ndarray, optional + Defaults to np.ones. Should have shape (*,nsubj) + where nsubj is the number of effects combined in the group analysis. + + Returns + ------- + minT: np.ndarray, minima of T statistic within mask, one for each + vector of signs + maxT: np.ndarray, maxima of T statistic within mask, one for each + vector of signs + """ + if api.is_image(mask): + maska = mask.get_data() + else: + maska = np.asarray(mask) + maska = maska.astype(np.bool) + + # Which subjects have this (contrast, design) pair? + subj_con_dirs = futil.subj_des_con_dirs(design, contrast) + + # Assemble effects and sds into 4D arrays + sds = [] + Ys = [] + for s in subj_con_dirs: + sd_img = load_image(pjoin(s, "sd.nii")) + effect_img = load_image(pjoin(s, "effect.nii")) + sds.append(sd_img.get_data()[maska]) + Ys.append(effect_img.get_data()[maska]) + sd = np.array(sds) + Y = np.array(Ys) + + if signs is None: + signs = np.ones((1, Y.shape[0])) + + maxT = np.empty(signs.shape[0]) + minT = np.empty(signs.shape[0]) + + for i, sign in enumerate(signs): + signY = sign[:,np.newaxis] * Y + varest = onesample.estimate_varatio(signY, sd) + random_var = varest['random'] + + adjusted_var = sd**2 + random_var + adjusted_sd = np.sqrt(adjusted_var) + + results = onesample.estimate_mean(Y, adjusted_sd) + T = results['t'] + minT[i], maxT[i] = np.nanmin(T), np.nanmax(T) + return minT, maxT + + +def permutation_test(design, contrast, mask=GROUP_MASK, nsample=1000): + """ + Perform a permutation (sign) test for a given design type and + contrast. It is a Monte Carlo test because we only sample nsample + possible sign arrays. + + Parameters + ---------- + design: str + one of ['block', 'event'] + contrast : str + name of contrast to estimate + mask : ``Image`` instance or array-like, optional + image containing mask, or array-like + nsample: int, optional + number of permutations + + Returns + ------- + min_vals: np.ndarray + max_vals: np.ndarray + """ + subj_con_dirs = futil.subj_des_con_dirs(design, contrast) + nsubj = len(subj_con_dirs) + if nsubj == 0: + raise ValueError('No subjects have %s, %s' % (design, contrast)) + signs = 2*np.greater(np.random.sample(size=(nsample, nsubj)), 0.5) - 1 + min_vals, max_vals = group_analysis_signs(design, contrast, mask, signs) + return min_vals, max_vals + + +def run_run_models(subject_nos=SUBJECTS, run_nos = RUNS): + """ Simple serial run of all the within-run models """ + for subj in subject_nos: + for run in run_nos: + try: + run_model(subj, run) + except IOError: + print('Skipping subject %d, run %d' % (subj, run)) + + +def run_fixed_models(subject_nos=SUBJECTS, designs=DESIGNS): + """ Simple serial run of all the within-subject models """ + for subj in subject_nos: + for design in designs: + try: + fixed_effects(subj, design) + except IOError: + print('Skipping subject %d, design %s' % (subj, design)) + + +def run_group_models(designs=DESIGNS, contrasts=CONTRASTS): + """ Simple serial run of all the across-subject models """ + for design in designs: + for contrast in contrasts: + group_analysis(design, contrast) + + +if __name__ == '__main__': + pass + # Sanity check while debugging + #permutation_test('block','sentence_0',mask=TINY_MASK,nsample=3) diff --git a/examples/ds105/ds105_util.py b/examples/ds105/ds105_util.py new file mode 100644 index 0000000000..124b1a3dba --- /dev/null +++ b/examples/ds105/ds105_util.py @@ -0,0 +1,292 @@ +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""Support utilities for ds105 example, mostly path management. + +The purpose of separating these is to keep the main example code as readable as +possible and focused on the experimental modeling and analysis, rather than on +local file management issues. + +Requires matplotlib +""" + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility + +# Stdlib +import os +from os import makedirs, listdir +from os.path import exists, abspath, isdir, join as pjoin, splitext +import csv +try: + from StringIO import StringIO # Python 2 +except ImportError: + from io import StringIO # Python 3 + +# Third party +import numpy as np +from matplotlib.mlab import csv2rec, rec2csv + +# From NIPY +from nipy.io.api import load_image + +#----------------------------------------------------------------------------- +# Globals +#----------------------------------------------------------------------------- + +# We assume that there is a directory holding the data and it's local to this +# code. Users can either keep a copy here or a symlink to the real location on +# disk of the data. +DATADIR = 'ds105_data' + +# Sanity check +if not os.path.isdir(DATADIR): + e="The data directory %s must exist and contain the ds105 data." % DATADIR + raise IOError(e) + +#----------------------------------------------------------------------------- +# Classes and functions +#----------------------------------------------------------------------------- + +# Path management utilities +def load_image_ds105(*path): + """Return a NIPY image from a set of path components. + """ + return load_image(pjoin(DATADIR, *path)) + + +def subj_des_con_dirs(design, contrast, subjects=range(1,7)): + """Return a list of subject directories with this `design` and `contrast` + + Parameters + ---------- + design : {'standard'} + contrast : str + subjects : list, optional + which subjects + + Returns + ------- + con_dirs : list + list of directories matching `design` and `contrast` + """ + rootdir = DATADIR + con_dirs = [] + for s in range(nsub): + f = pjoin(rootdir, "sub%03d" % s, "model", design, "fixed", contrast) + if isdir(f): + con_dirs.append(f) + return con_dirs + + +def path_info_run(subj, run, design='standard'): + """Construct path information dict for current subject/run. + + Parameters + ---------- + subj : int + subject number (1..6 inclusive) + run : int + run number (1..12 inclusive). + design : str, optional + which design to use, defaults to 'standard' + Returns + ------- + path_dict : dict + a dict with all the necessary path-related keys, including 'rootdir', + and 'design', where 'design' can have values 'event' or 'block' + depending on which type of run this was for subject no `subj` and run no + `run` + """ + path_dict = {'subj': subj, 'run': run, 'design':design} + rootdir = pjoin(DATADIR, "sub%(subj)03d", "model", "%(design)s") % path_dict + path_dict['rootdir'] = rootdir + path_dict['fsldir'] = pjoin(DATADIR, "sub%(subj)03d", "model", "model001") % path_dict + return path_dict + + +def path_info_design(subj, design): + """Construct path information dict for subject and design. + + Parameters + ---------- + subj : int + subject number (1..6 inclusive) + design : {'standard'} + type of design + + Returns + ------- + path_dict : dict + having keys 'rootdir', 'subj', 'design' + """ + path_dict = {'subj': subj, 'design': design} + rootdir = pjoin(DATADIR, "sub%(subj)03d", "model", "%(design)s") % path_dict + path_dict['rootdir'] = rootdir + path_dict['fsldir'] = pjoin(DATADIR, "sub%(subj)03d", "model", "model001") % path_dict + return path_dict + + +def results_table(path_dict): + """ Return precalculated results images for subject info in `path_dict` + + Parameters + ---------- + path_dict : dict + containing key 'rootdir' + + Returns + ------- + rtab : dict + dict with keys given by run directories for this subject, values being a + list with filenames of effect and sd images. + """ + # Which runs correspond to this design type? + rootdir = path_dict['rootdir'] + runs = filter(lambda f: isdir(pjoin(rootdir, f)), + ['results_run%03d' % i for i in range(1,13)] ) + + # Find out which contrasts have t-statistics, + # storing the filenames for reading below + + results = {} + + for rundir in runs: + rundir = pjoin(rootdir, rundir) + for condir in listdir(rundir): + for stat in ['sd', 'effect']: + fname_effect = abspath(pjoin(rundir, condir, 'effect.nii')) + fname_sd = abspath(pjoin(rundir, condir, 'sd.nii')) + if exists(fname_effect) and exists(fname_sd): + results.setdefault(condir, []).append([fname_effect, + fname_sd]) + return results + + +def get_experiment(path_dict): + """Get the record arrays for the experimental design. + + Parameters + ---------- + path_dict : dict + containing key 'rootdir', 'run', 'subj' + + Returns + ------- + experiment, initial : Two record arrays. + + """ + # The following two lines read in the .csv files + # and return recarrays, with fields + # experiment: ['time', 'sentence', 'speaker'] + # initial: ['time', 'initial'] + + rootdir = path_dict['rootdir'] + if not exists(pjoin(rootdir, "experiment_run%(run)03d.csv") % path_dict): + e = "can't find design for subject=%(subj)d,run=%(subj)d" % path_dict + raise IOError(e) + + experiment = csv2rec(pjoin(rootdir, "experiment_run%(run)03d.csv") % path_dict) + + return experiment + + +def get_fmri(path_dict): + """Get the images for a given subject/run. + + Parameters + ---------- + path_dict : dict + containing key 'fsldir', 'run' + + Returns + ------- + fmri : ndarray + anat : NIPY image + """ + fmri_im = load_image( + pjoin("%(fsldir)s/task001_run%(run)03d.feat/filtered_func_data.nii.gz") % path_dict) + return fmri_im + + +def ensure_dir(*path): + """Ensure a directory exists, making it if necessary. + + Returns the full path.""" + dirpath = pjoin(*path) + if not isdir(dirpath): + makedirs(dirpath) + return dirpath + + +def output_dir(path_dict, tcons, fcons): + """Get (and make if necessary) directory to write output into. + + Parameters + ---------- + path_dict : dict + containing key 'rootdir', 'run' + tcons : sequence of str + t contrasts + fcons : sequence of str + F contrasts + """ + rootdir = path_dict['rootdir'] + odir = pjoin(rootdir, "results_run%(run)03d" % path_dict) + ensure_dir(odir) + for n in tcons: + ensure_dir(odir,n) + for n in fcons: + ensure_dir(odir,n) + return odir + +def compare_results(subj, run, other_root, mask_fname): + """ Find and compare calculated results images from a previous run + + This scipt checks that another directory containing results of this same + analysis are similar in the sense of numpy ``allclose`` within a brain mask. + + Parameters + ---------- + subj : int + subject number (1..6) + run : int + run number (1..12) + other_root : str + path to previous run estimation + mask_fname: + path to a mask image defining area in which to compare differences + """ + # Get information for this subject and run + path_dict = path_info_run(subj, run) + # Get mask + msk = load_image(mask_fname).get_data().copy().astype(bool) + # Get results directories for this run + rootdir = path_dict['rootdir'] + res_dir = pjoin(rootdir, 'results_run%03d' % run) + if not isdir(res_dir): + return + for dirpath, dirnames, filenames in os.walk(res_dir): + for fname in filenames: + froot, ext = splitext(fname) + if froot in ('effect', 'sd', 'F', 't'): + this_fname = pjoin(dirpath, fname) + other_fname = this_fname.replace(DATADIR, other_root) + if not exists(other_fname): + print(this_fname, 'present but ', other_fname, 'missing') + continue + this_arr = load_image(this_fname).get_data() + other_arr = load_image(other_fname).get_data() + ok = np.allclose(this_arr[msk], other_arr[msk]) + if not ok and froot in ('effect', 'sd', 't'): # Maybe a sign flip + ok = np.allclose(this_arr[msk], -other_arr[msk]) + if not ok: + print('Difference between', this_fname, other_fname) + + +def compare_all(other_root, mask_fname): + """ Run results comparison for all subjects and runs """ + for subj in range(1,7): + for run in range(1, 13): + compare_results(subj, run, other_root, mask_fname) diff --git a/examples/ds105/parallel_run.py b/examples/ds105/parallel_run.py new file mode 100644 index 0000000000..c92dd6898d --- /dev/null +++ b/examples/ds105/parallel_run.py @@ -0,0 +1,136 @@ +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""Script to run the main analyses in parallel, using the IPython machinery. + +See ``ds105_example.py``. +""" +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +import os + +import numpy as np + +from IPython import parallel + +#----------------------------------------------------------------------------- +# Utility functions +#----------------------------------------------------------------------------- + +_client = None +def setup_client(): + """Get a Client and initialize it. + + This assumes that all nodes see a shared filesystem. + """ + global _client + if _client is None: + _client = parallel.Client() + mydir = os.path.split(os.path.abspath(__file__))[0] + def cd(path): + import os + os.chdir(path) + _client[:].apply_sync(cd, mydir) + return _client + + +def getruns(): + for i in range(1,7): + for j in range(1,13): + yield i, j + +ace_vs_scrambled_t/ +house_vs_scrambled_F/ house_vs_scrambled_t/ +object_bottle_0/ object_bottle_1/ +object_cat_0/ object_cat_1/ +object_chair_0/ object_chair_1/ +object_face_0/ object_face_1/ +object_house_0/ object_house_1/ + + +def getvals(): + for con in ['house_vs_scrambled_t', + 'chair_vs_scrambled_t', + 'face_vs_scrambled_t', + 'face_vs_house_t']: + for design in ['standard']: + yield design, con + +#----------------------------------------------------------------------------- +# Main analysis functions +#----------------------------------------------------------------------------- + +def fitruns(): + """Run the basic model fit.""" + rc = setup_client() + view = rc.load_balanced_view() + i_s, j_s = zip(*getruns()) + + def _fit(subj, run): + import fiac_example + try: + return fiac_example.run_model(subj, run) + except IOError: + pass + + return view.map(_fit, i_s, j_s) + + +def fitfixed(): + """Run the fixed effects analysis for all subjects.""" + rc = setup_client() + view = rc.load_balanced_view() + subjects = range(16) + + def _fit(subject): + import fiac_example + try: + fiac_example.fixed_effects(subject, "block") + except IOError: + pass + try: + fiac_example.fixed_effects(subject, "event") + except IOError: + pass + + return view.map(_fit, subjects) + + +def fitgroup(): + """Run the group analysis""" + rc = setup_client() + view = rc.load_balanced_view() + d_s, c_s = zip(*getvals()) + + def _fit(d, c): + import fiac_example + return fiac_example.group_analysis(d, c) + + return view.map(_fit, d_s, c_s) + + +def run_permute_test(design, contrast, nsample=1000): + rc = setup_client() + dview = rc[:] + nnod = len(dview) + # Samples per node. Round up + ns_nod = np.ceil(nsample / float(nnod)) + + def _run_test(n, des, con): + import fiac_example + from fiac_example import GROUP_MASK + min_vals, max_vals = fiac_example.permutation_test(des, con, + GROUP_MASK, n) + return min_vals, max_vals + + ar = dview.apply_async(_run_test, ns_nod, design, contrast) + min_vals, max_vals = zip(*[r for r in ar]) + return np.concatenate(min_vals), np.concatenate(max_vals) + + +#----------------------------------------------------------------------------- +# Script entry point +#----------------------------------------------------------------------------- +if __name__ == '__main__': + pass diff --git a/examples/ds105/view_contrasts_3d.py b/examples/ds105/view_contrasts_3d.py new file mode 100755 index 0000000000..a6af4f73a0 --- /dev/null +++ b/examples/ds105/view_contrasts_3d.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*- +# vi: set ft=python sts=4 ts=4 sw=4 et: +"""A quick and dirty example of using Mayavi to overlay anatomy and activation. +""" +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- +from __future__ import print_function # Python 2/3 compatibility + +import numpy as np + +try: + from mayavi import mlab +except ImportError: + try: + from enthought.mayavi import mlab + except ImportError: + raise RuntimeError('Need mayavi for this module') + +from ds105_util import load_image_ds105 + +#----------------------------------------------------------------------------- +# Globals +#----------------------------------------------------------------------------- + +MASK = load_image_fiac('group', 'mask.nii') +AVGANAT = load_image_fiac('group', 'avganat.nii') + +#----------------------------------------------------------------------------- +# Functions +#----------------------------------------------------------------------------- + +def view_thresholdedT(design, contrast, threshold, inequality=np.greater): + """ + A mayavi isosurface view of thresholded t-statistics + + Parameters + ---------- + design : {'standard'} + contrast : str + threshold : float + inequality : {np.greater, np.less}, optional + """ + maska = np.asarray(MASK) + tmap = np.array(load_image_ds105('group', design, contrast, 't.nii')) + test = inequality(tmap, threshold) + tval = np.zeros(tmap.shape) + tval[test] = tmap[test] + + # XXX make the array axes agree with mayavi2 + avganata = np.array(AVGANAT) + avganat_iso = mlab.contour3d(avganata * maska, opacity=0.3, contours=[3600], + color=(0.8,0.8,0.8)) + + avganat_iso.actor.property.backface_culling = True + avganat_iso.actor.property.ambient = 0.3 + + tval_iso = mlab.contour3d(tval * MASK, color=(0.8,0.3,0.3), + contours=[threshold]) + return avganat_iso, tval_iso + + +#----------------------------------------------------------------------------- +# Script entry point +#----------------------------------------------------------------------------- +if __name__ == '__main__': + # A simple example use case + design = 'standard' + contrast = 'house_vs_scrambled_t' + threshold = 0.3 + print('Starting thresholded view with:') + print('Design=', design, 'contrast=', contrast, 'threshold=', threshold) + view_thresholdedT(design, contrast, threshold) diff --git a/nipy/modalities/fmri/design.py b/nipy/modalities/fmri/design.py index 5692fa54b4..0f06582a80 100644 --- a/nipy/modalities/fmri/design.py +++ b/nipy/modalities/fmri/design.py @@ -11,7 +11,8 @@ from nipy.algorithms.statistics.formula.formulae import ( Formula, Factor, Term, make_recarray) -from .utils import events, fourier_basis as fourier_basis_sym +from .utils import (events, blocks, fourier_basis as fourier_basis_sym, + convolve_functions, T) from .hrf import glover @@ -79,7 +80,8 @@ def natural_spline(tvals, knots=None, order=3, intercept=True): return f.design(tvals, return_float=True) -def event_design(event_spec, t, order=2, hrfs=[glover]): +def event_design(event_spec, t, order=2, hrfs=[glover], + level_contrasts=False): """ Create a design matrix for a GLM analysis based on an event specification, evaluating @@ -102,6 +104,9 @@ def event_design(event_spec, t, order=2, hrfs=[glover]): hrfs : seq A sequence of (symbolic) HRF that will be convolved with each event. If empty, glover is used. + level_contrasts : bool + If true, generate contrasts for each individual level + of each factor. Returns ------- @@ -121,6 +126,7 @@ def event_design(event_spec, t, order=2, hrfs=[glover]): e_factors = [Factor(n, np.unique(event_spec[n])) for n in fields] e_formula = np.product(e_factors) e_contrasts = {} + if len(e_factors) > 1: for i in range(1, order+1): for comb in combinations(zip(fields, e_factors), i): @@ -142,8 +148,11 @@ def event_design(event_spec, t, order=2, hrfs=[glover]): t_terms = [] t_contrasts = {} for l, h in enumerate(hrfs): - t_terms += [events(event_spec['time'], \ - amplitudes=e_X[n], f=h) for i, n in enumerate(e_dtype.names)] + for n in e_dtype.names: + term = events(event_spec['time'], amplitudes=e_X[n], f=h) + t_terms += [term] + if level_contrasts: + t_contrasts['%s_%d' % (n, l)] = Formula([term]) for n, c in e_contrasts.items(): t_contrasts["%s_%d" % (n, l)] = Formula([ \ events(event_spec['time'], amplitudes=c[nn], f=h) @@ -155,6 +164,119 @@ def event_design(event_spec, t, order=2, hrfs=[glover]): return X_t, c_t +def block_design(block_spec, t, order=2, hrfs=[glover], + convolution_padding=5., + convolution_dt=0.02, + hrf_interval=[0.,30.], + level_contrasts=False): + """ + Create a design matrix for a GLM analysis based + on a block specification, evaluating + it a sequence of time values. Each column + in the design matrix will be convolved with each HRF in hrfs. + + Parameters + ---------- + block_spec : np.recarray + A recarray having at least a field named 'start' + and a field named 'end' signifying the + block time, and all other fields will be treated as factors in an + ANOVA-type model. + t : np.ndarray + An array of np.float values at which to evaluate the + design. Common examples would be the acquisition times of an fMRI + image. + order : int + The highest order interaction to be considered in constructing + the contrast matrices. + hrfs : seq + A sequence of (symbolic) HRF that will be convolved with each + block. If empty, glover is used. + convolution_padding : float + A padding for the convolution with the HRF. The intervals + used for the convolution are the smallest 'start' minus this + padding to the largest 'end' plus this padding. + convolution_padding : dt + Time step for use in convolving the blocks with each + HRF. + hrf_interval: sequence of floats + Interval over which the HRF is assumed supported, used in the + convolution. + level_contrasts : bool + If true, generate contrasts for each individual level + of each factor. + + Returns + ------- + X : np.ndarray + The design matrix with X.shape[0] == t.shape[0]. The number of + columns will depend on the other fields of block_spec. + contrasts : dict + Dictionary of contrasts that is expected to be of interest from + the block specification. For each interaction / effect up to a + given order will be returned. Also, a contrast is generated for + each interaction / effect for each HRF specified in hrfs. + """ + fields = list(block_spec.dtype.names) + if 'start' not in fields or 'end' not in fields: + raise ValueError('expecting fields called "start" and "end"') + fields.pop(fields.index('start')) + fields.pop(fields.index('end')) + e_factors = [Factor(n, np.unique(block_spec[n])) for n in fields] + e_formula = np.product(e_factors) + e_contrasts = {} + if len(e_factors) > 1: + for i in range(1, order+1): + for comb in combinations(zip(fields, e_factors), i): + names = [c[0] for c in comb] + fs = [c[1].main_effect for c in comb] + e_contrasts[":".join(names)] = np.product(fs).design(block_spec) + + e_contrasts['constant'] = formulae.I.design(block_spec) + + # Design and contrasts in block space + # TODO: make it so I don't have to call design twice here + # to get both the contrasts and the e_X matrix as a recarray + + e_X = e_formula.design(block_spec) + e_dtype = e_formula.dtype + + # Now construct the design in time space + + block_times = np.array([(s,e) for s, e in zip(block_spec['start'], + block_spec['end'])]) + convolution_interval = (block_times.min() - convolution_padding, + block_times.max() + convolution_padding) + + t_terms = [] + t_names = [] + t_contrasts = {} + for l, h in enumerate(hrfs): + for n in e_dtype.names: + B = blocks(block_times, amplitudes=e_X[n]) + term = convolve_functions(B, h(T), + convolution_interval, + hrf_interval, + convolution_dt) + t_terms += [term] + if level_contrasts: + t_contrasts['%s_%d' % (n, l)] = Formula([term]) + for n, c in e_contrasts.items(): + F = [] + for i, nn in enumerate(c.dtype.names): + B = blocks(block_times, amplitudes=c[nn]) + F.append(convolve_functions(B, h(T), + convolution_interval, + hrf_interval, + convolution_dt)) + t_contrasts["%s_%d" % (n, l)] = Formula(F) + t_formula = Formula(t_terms) + + tval = make_recarray(t, ['t']) + X_t, c_t = t_formula.design(tval, contrasts=t_contrasts) + return X_t, c_t + + def stack2designs(old_X, new_X, old_contrasts={}, new_contrasts={}): """ Add some columns to a design matrix that has contrasts matrices